View source: R/sparse_matrix_tools.R
| collapse_sparse_rows | R Documentation |
Collapse sparse matrix rows by group
collapse_sparse_rows(matrix, group)
matrix |
A sparse matrix. |
group |
A vector defining the output row groups. |
A sparse matrix with rows collapsed by 'group'.
mat <- Matrix::Matrix(
matrix(c(1, 0, 2, 0, 3, 4), nrow = 3, byrow = TRUE),
sparse = TRUE
)
collapse_sparse_rows(mat, c("g1", "g1", "g2"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.