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
bug an unexpected problem or unintended behavior
Milestone

Comments

@krlmlr
Copy link
Member

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 an unexpected problem or unintended behavior label Jul 30, 2018
@anhqle
Copy link
Contributor

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 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 an unexpected problem or unintended behavior labels Aug 1, 2018
@krlmlr krlmlr added this to the 1.5.0 milestone Oct 5, 2018
@hadley
Copy link
Member

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 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 an unexpected problem or unintended behavior and removed documentation labels Oct 6, 2018
@krlmlr krlmlr closed this as completed in 0e104a7 Oct 6, 2018
@github-actions
Copy link
Contributor

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
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants