Learn R Programming

splitstackshape (version 1.0)

valueMat: Create a binary matrix from a list of values

Description

Create a binary matrix from a list of values

Usage

valueMat(listOfValues, fill = NA)

Arguments

listOfValues
A list of input values to be inserted in a matrix.
fill
The initializing fill value for the empty matrix.

Value

  • A matrix.

Details

This is primarily a helper function for the concat.split function when creating the "expanded" structure. The input is anticipated to be a list of values obtained using strsplit.

See Also

strsplit, binaryMat

Examples

Run this code
invec <- c("1,2,4,5,6", "1,2,4,5,6", "1,2,4,5,6",
           "1,2,4,5,6", "1,2,5,6", "1,2,5,6")
A <- strsplit(invec, ",")
splitstackshape:::valueMat(A)
splitstackshape:::valueMat(A, "ZZZ")

rm(invec, A)

Run the code above in your browser using DataLab