Closed PathosEthosLogos closed 9 months ago
Hmm it looks like a vector of length 0 should be kept when keep_empty = TRUE
(currently it only works on NULL
elements)
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
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