Learn R Programming

splitstackshape (version 1.4.8)

listCol_w: Flatten a Column Stored as a List

Description

Flattens a column stored as a list into a wide form.

Usage

listCol_w(inDT, listcol, drop = TRUE, fill = NA_character_)

Arguments

inDT

The input dataset.

listcol

The name of the column stored as a list.

drop

Logical. Should the original column be dropped? Defaults to TRUE.

fill

The desired fill value. Defaults to NA_character_.

Value

A data.table.

See Also

listCol_l to unlist a list column into a "long" format.

Examples

Run this code
# NOT RUN {
dat <- data.frame(A = 1:3, B = I(list(c(1, 2), c(1, 3, 5), c(4))))
listCol_w(dat, "B")

# }

Run the code above in your browser using DataLab