From: xxgr...@hotmail.com To: r-help-boun...@r-project.org Subject: compare a vector and a row of a matrix Date: Sun, 26 Sep 2010 23:23:52 +0800 Hi Everyone: I am trying to compare a vector and rows of a matrix for example > xn <- c(1,2,4,4,5,5,5,6) >yn <- c(1,2,5,7,1,2,3,1) >mtrx <- cbind(xn, yn) when I tried, say, > c (1,4), the result was TRUE, TRUE. I think the reason is that 1 is compared to xn and 4 is compared to yn seperately. Could anyone tell me how I can get a single result of the comparson between a vector and a row of the matrix? for example£¬ c(1,1) is one row of the matrix but c(1,4) is not. I tried to write a loop but it seems long for this simple problem Thank you very much!!! [[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.