Get specific columns/rows fo a matrix | R Documentation |
Get specific columns/rows of a matrix.
columns(x,indices)
rows(x,indices)
x |
A matrix with data. |
indices |
An integer vector with the indices. |
A matrix with the specific columns/rows of argumment indices.
Manos Papadakis
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.
rowMins, rowFalse, nth, colrange, colMedians, colVars, colSort, rowSort, rowTrue
x <- matrix(runif(100*100),100,100)
indices = sample(1:100,50)
all.equal(x[,indices],columns(x,indices))
all.equal(x[indices,],rows(x,indices))
x<-indices<-NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.