matrix_to_blocks {turner} | R Documentation |
Split a matrix into blocks
Description
Split a matrix into a list of blocks (either by rows or by columns)
Usage
matrix_to_blocks(Matrix, blocks, byrow = TRUE)
Arguments
Matrix |
a matrix to split |
blocks |
either a list or a vector indicating the
blocks. If |
byrow |
logical. If |
Value
A list of matrices
Author(s)
Gaston Sanchez
See Also
Examples
# matrix with 10 rows and 7 columns
M = matrix(rnorm(70), 10, 7)
# row blocks
row_sets = list(1:3, 4:5, 6:10)
# split matrix by rows
matrix_to_blocks(M, row_sets)
# column blocks
col_sets = c(3, 4)
# split matrix by rows
matrix_to_blocks(M, col_sets, byrow=FALSE)
[Package turner version 0.1.9 Index]