split_matrix {sFFLHD} | R Documentation |
Split a matrix by rows, based on either the number of rows per group or number of splits.
split_matrix(mat, rowspergroup = NULL, nsplits = NULL, shuffle = TRUE)
mat |
A matrix to be split. |
rowspergroup |
Number of rows in a group. |
nsplits |
Number of splits to make. |
shuffle |
Should the splits be shuffled before returning? |
A list of the splits of the matrix.
mat <- matrix(1:12, ncol=2)
split_matrix(mat, 4, shuffle=FALSE)
split_matrix(mat, 4, shuffle=TRUE)
split_matrix(mat, nsplits=3, shuffle=FALSE) # same as 4 rowspergroup