split_matrix: Split a matrix by rows, based on either the number of rows...

Description Usage Arguments Value Examples

Description

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

Usage

1
2
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

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

CollinErickson/sFFLHD documentation built on May 6, 2019, 12:28 p.m.