lengthener: Lengthens a Dataset by Combination of Columns

Description Usage Arguments Value Author(s) References Examples

View source: R/lengthener.R

Description

Creates a long dataset of "n" columns comprising the combinations of values from different columns.

Usage

1
lengthener(indt, n = 2)

Arguments

indt

The input dataset.

n

The number of columns expected. Passed on to combn.

Value

A data.table.

Author(s)

Ananda Mahto

References

http://stackoverflow.com/q/35690478/1270695

Examples

1
2
3
mydf <- as.data.frame(matrix(c(1,2,3,4,0,0,1,1), byrow = TRUE, nrow = 2))
lengthener(mydf, 2)
lengthener(mydf, 3)

mrdwab/SOfun documentation built on June 20, 2020, 6:15 p.m.