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!

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to