Closed karldw closed 6 years ago
Oooh good idea!
I think this will need some extra syntax, maybe something like unnest(df, y, preserve = x)
Thank you! I think there's still an issue when the list variables aren't specified, but .preserve
is.
I think the solution is to add something like:
if (is_empty(quos)) {
list_cols <- names(data)[map_lgl(data, is_list)]
list_cols <- tidyselect::vars_select(list_cols, -!!! enquo(.preserve)) # deselect .preserve vars
quos <- syms(list_cols)
}
but the line above is wrong because I don't have the unquotation right.
unnest
currently can't handle multiple list columns with different lengths. If the user requests an unnesting of one list column from a dataframe with multiple,unnest
will fail if the number of elements differs. Would it be possible forunnest
to copy the other list columns, just as it copies values from standard, atomic columns?In particular, the current behavior means
unnest
doesn't work withsf
data, since thegeometry
column is already a list column.Ref: https://github.com/r-spatial/sf/issues/426