mat01: Character List to Binary (membership) Matrix

View source: R/mat01.R

mat01R Documentation

Character List to Binary (membership) Matrix

Description

Convert a list of character vectors to a matrix with i columns and j rows, where i are the list vector names and j are the unique elements found across i vectors. Cell i,j has a value of 1 if element j exists in vector i, and a value of 0 otherwise.

Usage

mat01(L)

Arguments

L

list of character vectors

Value

matrix of 0s and 1s with as many columns as there are vectors in the list and as many rows as there are unique elements across all vectors.

Examples

## Not run: 
if(interactive()){
 L = list(orig = letters, subset = sample(letters, 5))
 head(mat01(L))
 }

## End(Not run)

jlaffy/scalop documentation built on March 24, 2024, 9 a.m.