split_matrix {sFFLHD}R Documentation

Split a matrix by rows, based on either the number of rows per group or number of splits.

Description

Split a matrix by rows, based on either the number of rows per group or number of splits.

Usage

split_matrix(mat, rowspergroup = NULL, nsplits = NULL, shuffle = TRUE)

Arguments

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?

Value

A list of the splits of the matrix.

Examples

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

[Package sFFLHD version 0.1.2 Index]