Description Usage Arguments Value Examples
Split a matrix by rows, based on either the number of rows per group or number of splits.
1 | 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.
1 2 3 4 | 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.