Closed florianm closed 4 years ago
I'm not sure why that code ever worked because y
is not a list. If you unnest()
x
instead, it works as expected:
library(tidyr)
df <- tibble(x = list(), y = integer())
df %>% unnest(x)
#> # A tibble: 0 x 2
#> # … with 2 variables: x <???>, y <int>
Summary
I can reproduce here that #650 still persists with
tidyr_1.0.0.9000
.On a side note,
tidyr_1.0.0.9000
fixes the behaviour ofunnest_wider()
: When unnesting a list,unnest_wider()
in versions before 1.0.0.9000 seems to have trouble if a nested list in the first record is empty, but subsequent records have data in those nested list elements. I'm struggling a bit with a reproducible example here but have provided what I can below.tidyr
version 1.0.0.9000 (current master)The example from https://github.com/tidyverse/tidyr/issues/650#issuecomment-514683131 doesn't work as expected:
Created on 2019-12-04 by the reprex package (v0.3.0)
However,
tidyr_1.0.0.9000
fixes my issue https://github.com/dbca-wa/ruODK/issues/46.tidyr::unnest_wider()
to rectangle list of lists.tidyr
version 1.0.0 (current CRAN)Created on 2019-12-04 by the reprex package (v0.3.0)
Important difference:
tidyr_1.0.0
causes my issue https://github.com/dbca-wa/ruODK/issues/46.Significant bit from the trace: unchop does
keep_empty
, butvec_bind
probably has a hard time guessing the.ptype
from the incomplete first record.Error and trace in details.