listCol_w {splitstackshape}R Documentation

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.

Author(s)

Ananda Mahto

See Also

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

Examples


dat <- data.frame(A = 1:3, B = I(list(c(1, 2), c(1, 3, 5), c(4))))
listCol_w(dat, "B")


[Package splitstackshape version 1.4.8 Index]