We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Discovered through https://community.rstudio.com/t/a-chr-column-has-vectors-and-atomic-values-how-can-i-turn-those-vectors-into-longer-pivoted-rows/177823
library(tidyverse) |> suppressPackageStartupMessages() df_example <- tibble(a = list(c('a','b'), character(0), "z", c('y','z')), id = list('aa', 'bb', 'cc', 'cc')) df_example |> unnest(cols = a,keep_empty = TRUE) #> # A tibble: 6 × 2 #> a id #> <chr> <list> #> 1 a <chr [1]> #> 2 b <chr [1]> #> 3 <NA> <chr [1]> #> 4 z <chr [1]> #> 5 y <chr [1]> #> 6 z <chr [1]>
library(tidytable) |> suppressPackageStartupMessages() df_example <- tidytable(a = list(c('a','b'), character(0), "z", c('y','z')), id = list('aa', 'bb', 'cc', 'cc')) df_example |> unnest(a, keep_empty = TRUE) #> # A tidytable: 5 × 1 #> a #> <chr> #> 1 a #> 2 b #> 3 z #> 4 y #> 5 z
Created on 2023-11-28 with reprex v2.0.2
The text was updated successfully, but these errors were encountered:
Hmm it looks like a vector of length 0 should be kept when keep_empty = TRUE (currently it only works on NULL elements)
keep_empty = TRUE
NULL
Sorry, something went wrong.
unnest(keep_empty = TRUE)
All set - thanks for catching this
library(tidytable) |> suppressPackageStartupMessages() df_example <- tidytable(a = list(c('a','b'), character(0), "z", c('y','z')), id = list('aa', 'bb', 'cc', 'cc')) df_example |> unnest(a, keep_empty = TRUE) #> # A tidytable: 6 × 1 #> a #> <chr> #> 1 a #> 2 b #> 3 <NA> #> 4 z #> 5 y #> 6 z
Successfully merging a pull request may close this issue.
Discovered through https://community.rstudio.com/t/a-chr-column-has-vectors-and-atomic-values-how-can-i-turn-those-vectors-into-longer-pivoted-rows/177823
Created on 2023-11-28 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: