From: Christos Hatzis <christos_at_nuverabio.com>

Date: Sat 20 Jan 2007 - 22:56:09 GMT

})

Date: Sat 20 Jan 2007 - 22:56:09 GMT

apply(mat2, 1, function(x) which(apply(mat1, 1, function(y) all(x == y)) ==
**TRUE))
**
-Christos

-----Original Message-----

From: r-help-bounces@stat.math.ethz.ch

[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Adrian Dusa
Sent: Saturday, January 20, 2007 5:15 PM
To: r-help@stat.math.ethz.ch

Subject: [R] comparing two matrices

I have two matrices:

mat1 <- expand.grid(0:2, 0:2, 0:2)

mat2 <- aa[c(19, 16, 13, 24, 8), ]

where mat2 is always a subset of mat1

which(apply(mat1, 1, function(y) {

sum(x == y) }) == ncol(mat1))

})

Thank you,

Adrian

-- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romania Tel./Fax: +40 21 3126618 \ +40 21 3120210 / int.101Received on Sun Jan 21 10:00:26 2007

______________________________________________

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 and provide commented, minimal, self-contained, reproducible code.

______________________________________________

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 and provide commented, minimal, self-contained, reproducible code.

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Sun 21 Jan 2007 - 10:30:22 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*