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.

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

if (FALSE) {
if(interactive()){
 L = list(orig = letters, subset = sample(letters, 5))
 head(mat01(L))
 }
}