sample.cols {multivariance} | R Documentation |
resample the columns of a matrix
sample.cols(x, vec = 1:ncol(x), replace = TRUE, incl.first = TRUE)
x |
matrix |
vec |
vector, indicates which columns belong together |
replace |
boolean, sampling with or without replacement |
incl.first |
boolean, if |
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.
sample.cols(matrix(1:15,nrow = 5),vec = c(1,1,2))