blocksel | R Documentation |
Function blocksel
selects blocks (i.e. sets of columns) within a given matrix and concatenates the selected blocks into a new matrix.
blocksel(X, blocks)
X |
A |
blocks |
A list of same length as the number of blocks. Each component of the list gives the column numbers in |
X |
A matrix with the concatenated blocks. |
blocks |
A list of column numbers defining the blocks in the output matrix |
n <- 3 ; p <- 10
set.seed(1)
X <- matrix(rnorm(n * p, mean = 10), ncol = p, byrow = TRUE)
colnames(X) <- paste("Var", 1:p, sep = "")
set.seed(NULL)
X
blocks <- list(1:2, 4, 6:8)
blocks
blocksel(X, blocks)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.