Create a design-type matrix based on the elements of a list. Each column in the produced matrix is linked to the vectors in the list. See example.

list_to_matrix(alist)

Arguments

alist

a list of numeric vectors

Value

A design-type matrix

Author

Gaston Sanchez

Examples

# let's say you have a list like this
num_list = list(1:3, 4:5, 6:9)

# get design-type matrix
list_to_matrix(num_list)
#>       [,1] [,2] [,3]
#>  [1,]    1    0    0
#>  [2,]    2    0    0
#>  [3,]    3    0    0
#>  [4,]    0    4    0
#>  [5,]    0    5    0
#>  [6,]    0    0    6
#>  [7,]    0    0    7
#>  [8,]    0    0    8
#>  [9,]    0    0    9