sample.cols {multivariance}R Documentation

resample the columns of a matrix

Description

resample the columns of a matrix

Usage

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

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


[Package multivariance version 2.4.1 Index]