Matrix representatation of list of vectors and vice versa

set_list2matrix(set_list, aggregate = FALSE)

matrix2set_list(set_matrix)

Arguments

set_list

list of vectors

aggregate

should the vectors be aggregated

set_matrix

matrix representatation

Examples

l <- list(c(1,2,3), c(3,2,4), c(3,2,4))
m1 <- set_list2matrix(l)
m1
#>      1 2 3 4
#> [1,] 1 1 1 0
#> [2,] 0 1 1 1
#> [3,] 0 1 1 1
matrix2set_list(m1)
#> [[1]]
#> [1] "1" "2" "3"
#> 
#> [[2]]
#> [1] "2" "3" "4"
#> 
#> [[3]]
#> [1] "2" "3" "4"
#> 

m2 <- set_list2matrix(l, aggregate=TRUE)
m2
#>      1 2 3 4 Freq__
#> [1,] 0 1 1 1      2
#> [2,] 1 1 1 0      1
matrix2set_list(m2)
#> [[1]]
#> [1] "2" "3" "4"
#> 
#> [[2]]
#> [1] "2" "3" "4"
#> 
#> [[3]]
#> [1] "1" "2" "3"
#>