Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behavior with [, , drop = TRUE] and nrow() == 1 #442

Closed
krlmlr opened this issue Jul 30, 2018 · 5 comments
Closed

Strange behavior with [, , drop = TRUE] and nrow() == 1 #442

krlmlr opened this issue Jul 30, 2018 · 5 comments
Labels
Milestone

Comments

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Jul 30, 2018

tibble::tibble(a = 1:3, b = 4:6)[1,, drop = TRUE]
#> $a
#> [1] 1
#> 
#> $b
#> [1] 4

Created on 2018-07-30 by the reprex package (v0.2.0).

@krlmlr krlmlr added the bug label Jul 30, 2018
@anhqle
Copy link
Contributor

@anhqle anhqle commented Aug 1, 2018

What's the expected behavior here? Is tibble not supposed to work like data.frame in this regard?

> data.frame(a = 1:3, b = 4:6)[1,, drop = TRUE]
$a
[1] 1

$b
[1] 4
@krlmlr
Copy link
Member Author

@krlmlr krlmlr commented Aug 1, 2018

Thanks, in this case we just keep the data frame behavior (but add a comment to the surprising section in the code).

@krlmlr krlmlr added documentation and removed bug labels Aug 1, 2018
@krlmlr krlmlr added this to the 1.5.0 milestone Oct 5, 2018
@hadley
Copy link
Member

@hadley hadley commented Oct 6, 2018

I'm not sure how we got to this place - I strongly believe that [ should only ever return a data frame, and this list special case is a bad idea.

@krlmlr
Copy link
Member Author

@krlmlr krlmlr commented Oct 6, 2018

Looks like we reimplemented the behavior of "[.data.frame"() by accident. More than happy to change this.

@krlmlr krlmlr added bug and removed documentation labels Oct 6, 2018
@krlmlr krlmlr closed this in 0e104a7 Oct 6, 2018
@github-actions
Copy link

@github-actions github-actions bot commented Dec 10, 2020

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants