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 · 4 comments

Comments

Projects
None yet
3 participants
@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 label Jul 30, 2018

@anhqle

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment