Dear list,

Suppose I have the following matrix:
> M <- matrix(c("1","2","3","2","4","5","5","3","2","1","3","2","4","4"), ncol=2)
> M
     [,1] [,2]
[1,] "1"  "3"
[2,] "2"  "2"
[3,] "3"  "1"
[4,] "2"  "3"
[5,] "4"  "2"
[6,] "5"  "4"
[7,] "5"  "4"

In this matrix, row 1 contains elements "1" and "3" and row 3 does the same. Similarly, rows 6 and 7 contain the same elements. I am looking for a way to efficiently identify these rows. I cannot use duplicated(M), since the order of the names in the rows does not matter, all that matters is that *all* names in a row also *all* appear in another row. How can I identify such "duplicated" rows, without going through a process of looping and shifting elements around?

thanks, Peter

______________________________________________
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