dt_hoist: Hoist: Fast Unnesting of Vectors

Description Usage Arguments Examples

View source: R/unnest.R

Description

Quickly unnest vectors nested in list columns. Still experimental (has some potentially unexpected behavior in some situations)!

Usage

1
dt_hoist(dt_, ...)

Arguments

dt_

the data table to unnest

...

the columns to unnest (must all be the sample length when unnested); use bare names of the variables

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(data.table)
dt <- data.table(
   x = rnorm(1e5),
   y = runif(1e5),
   nested1 = lapply(1:10, sample, 10, replace = TRUE),
   nested2 = lapply(c("thing1", "thing2"), sample, 10, replace = TRUE),
   id = 1:1e5
   )

dt_hoist(dt,
         nested1, nested2,
         by = id)

TysonStanley/tidyfast documentation built on Dec. 8, 2019, 9:46 a.m.