powered by
Quickly unnest data tables, particularly those nested by dt_nest().
dt_nest()
dt_unnest(dt_, col, keep = TRUE)
the data table to unnest
the column to unnest
whether to keep the nested column, default is TRUE
TRUE
library(data.table) dt <- data.table( x = rnorm(1e5), y = runif(1e5), grp = sample(1L:3L, 1e5, replace = TRUE) ) nested <- dt_nest(dt, grp) dt_unnest(nested, col = data)
Run the code above in your browser using DataLab