dt.ls2c: Replaces data.table columns of type list to a column of type...

dt.ls2cR Documentation

Replaces data.table columns of type list to a column of type vector in-place.

Description

Replaces data.table columns of type list to a column of type vector in-place.

Usage

dt.ls2c(DT, column.names = NULL)

Arguments

DT

A data.table.

column.names

A character vector containing column names you want to convert from list type to vectors. If no column names are specified, the function read through the entire data.table (Default: column.names = NULL).

Value

A data.table.

Author(s)

Yoann Pageaud.

Examples

dtbl<-data.table(
  col1 = rev(seq(16)),
  col2=as.list(rep(x = c("hello", "world"), 8))) #'col2' is of type 'list'.
dt.ls2c(DT = dtbl) #All columns of type 'list' are converted into vectors.
dt.ls2c(DT = dtbl, column.names = "col2") #Only 'col2' is converted into a vector.

YoannPa/DTrsiv documentation built on Nov. 28, 2022, 5:44 p.m.