sample.cols: resample the columns of a matrix

Description Usage Arguments Value Examples

View source: R/multivariance-functions.R

Description

resample the columns of a matrix

Usage

1
sample.cols(x, vec = 1:ncol(x), replace = TRUE, incl.first = TRUE)

Arguments

x

matrix

vec

vector, indicates which columns belong together

replace

boolean, sampling with or without replacement

incl.first

boolean, if TRUE also the first component is resampled

Value

Returns a matrix with the same dimensions as x. The columns are resampled from the original columns. The resampling is done with replacement (replace = TRUE) or without (replace = FALSE). Columns which belong together (indicated by vec) are resampled identically, i.e., all values in rows of these are kept together.

Examples

1
sample.cols(matrix(1:15,nrow = 5),vec = c(1,1,2))

multivariance documentation built on Oct. 6, 2021, 5:08 p.m.