unnest | R Documentation |
Unnest list-columns.
unnest(
.df,
...,
keep_empty = FALSE,
.drop = TRUE,
names_sep = NULL,
names_repair = "unique"
)
.df |
A data.table |
... |
Columns to unnest If empty, unnests all list columns. |
keep_empty |
Return |
.drop |
Should list columns that were not unnested be dropped |
names_sep |
If NULL, the default, the inner column names will become the new outer column names. If a string, the name of the outer column will be appended to the beginning of the inner column names,
with |
names_repair |
Treatment of duplicate names. See |
df1 <- tidytable(x = 1:3, y = 1:3)
df2 <- tidytable(x = 1:2, y = 1:2)
nested_df <-
data.table(
a = c("a", "b"),
frame_list = list(df1, df2),
vec_list = list(4:6, 7:8)
)
nested_df %>%
unnest(frame_list)
nested_df %>%
unnest(frame_list, names_sep = "_")
nested_df %>%
unnest(frame_list, vec_list)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.