unnest_longer {tidytable} | R Documentation |
Unnest a list-column of vectors into regular columns
Description
Turns each element of a list-column into a row.
Usage
unnest_longer(
.df,
col,
values_to = NULL,
indices_to = NULL,
indices_include = NULL,
keep_empty = FALSE,
names_repair = "check_unique",
simplify = NULL,
ptype = NULL,
transform = NULL
)
Arguments
.df |
A data.table or data.frame |
col |
Column to unnest |
values_to |
Name of column to store values |
indices_to |
Name of column to store indices |
indices_include |
Should an index column be included?
Defaults to |
keep_empty |
Return |
names_repair |
Treatment of duplicate names. See |
simplify |
Currently not supported. Errors if not |
ptype |
Optionally a named list of ptypes declaring the desired output type of each component. |
transform |
Optionally a named list of transformation functions applied to each component. |
Examples
df <- tidytable(
x = 1:3,
y = list(0, 1:3, 4:5)
)
df %>% unnest_longer(y)
[Package tidytable version 0.11.1 Index]