-
Notifications
You must be signed in to change notification settings - Fork 129
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
tibble() is dropping inner names #630
Comments
This is the guilty commit: defe1ee |
From the just-previous commit 96cbc7a, I see: devtools::load_all("~/rrr/tibble")
#> Loading tibble
df <- tibble(x = 1:2, y = list(a = 1, b = 1:2))
df$y
#> $a
#> [1] 1
#>
#> $b
#> [1] 1 2
names(df$y)
#> [1] "a" "b" Created on 2019-08-07 by the reprex package (v0.3.0.9000) |
Thanks. I submitted a PR to fix the tests in tidyr. Are there legitimate use cases for inner names apart from the (now deprecated) use of This is what I see: # Names are dropped for atomic vectors
df <- data.frame(a = c(x = 1, y = 2), b = c(z = 3, w = 4))
df$a
#> [1] 1 2
df$b
#> [1] 3 4
# Names are retained for lists
df <- data.frame(a = I(list(x = 1, y = 2)), b = I(list(z = 3, w = 4)))
df$a
#> $x
#> [1] 1
#>
#> $y
#> [1] 2
df$b
#> $z
#> [1] 3
#>
#> $w
#> [1] 4
library(tidyverse)
# Names are dropped after dplyr operations
df %>%
slice(1) %>%
pull()
#> [[1]]
#> [1] 3 Created on 2019-08-08 by the reprex package (v0.3.0) It seems that inner names aren't well supported in the tidyverse anyway (nor in base). I'm in favor of removing them early on. |
I don't understand why we are stripping names from all columns. I think you should remove
all together. |
I don't understand why we should allow names in columns. Are there legitimate use cases? We never allowed names for columns of atomic types. Now we also drop names from bare lists, via |
|
tibble 1.0 keeps internal names also for atomic types, 1.1 doesn't. Need to bisect. |
09a07b5 is the first commit that strips internal names from atomic types. It looks like the names were stripped accidentally. |
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. |
Noticed because an incidental update of my local tibble caused pretty catastrophic test failure in tidyr, whose release / revdeps I'm working on. I'm at current HEAD of tibble here.
Created on 2019-08-07 by the reprex package (v0.3.0.9000)
The text was updated successfully, but these errors were encountered: