| list_of_rows_or_cols | R Documentation |
This function takes matrix m and converts it to a list of
single-row (if margin == 1) or single-column(if margin == 2)
matrices.
Each item in the list is named for its row (if margin == 1)
or column (if margin == 2).
list_of_rows_or_cols(a, margin)
a |
a matrix or list of matrices (say, from a column of a data frame) |
margin |
the margin of the matrices to be extracted ( |
Note that the result provides column vectors, regardless of the value of margin.
a named list of rows or columns extracted from m
m <- matrix(data = c(1:6),
nrow = 2, ncol = 3,
dimnames = list(c("p1", "p2"), c("i1", "i2", "i3"))) %>%
setrowtype(rowtype = "Products") %>% setcoltype(coltype = "Industries")
list_of_rows_or_cols(m, margin = 1)
list_of_rows_or_cols(m, margin = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.