Hi all,

What would be an efficient way to match rows of a matrix to a vector?

ex:

m<-matrix(1:9, nrow=3)

m     [,1] [,2] [,3]
[1,]    1    4    7
[2,]    2    5    8
[3,]    3    6    9

#################################
which(m==c(2,5,8))        # I want this to return 2
######################

Thanks,
Sachin

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to