[R] extraction - subsets
Roberto Furlan
roberto.furlan at gmail.com
Sat Mar 18 18:47:47 CET 2006
Hi everybody,
let us assume i have the following matrixX and vectorY
matrixX <- runif(100)
dim(matrixX) <- c(10,10)
vectorY <- as.matrix(as.character(seq(1,10)))
if I define:
subsample<-c("2")
i can extract the rows from matriX based on the elements in vectorY which
are listed in subsample
matrixX[vectorY==subsample]
if I define subsample with more than 1 element, such as:
subsample=c("2", "3")
how can i extract the rows from matriX based on the elements in vectorY
which are listed in subsample?
many thanks
Roberto Furlan
University of Turin
--
----------------------------------------
La mia Cartella di Posta in Arrivo è protetta da SPAMfighter
259 messaggi contenenti spam sono stati bloccati con successo.
Scarica gratuitamente SPAMfighter!
More information about the R-help
mailing list