I have a matrix like this:
M <- rbind(c("CD4", "CD8"),
c("CD8", "CD4"),
c("DN", "CD8"),
c("CD8", "DN"),
c("CD4", "DN"),
c("DN", "CD4"))
The 1st and 2nd is duplicated, and 3rd and 4th is duplicated, and 5th and 6th is duplicated since they included the same elements (no matter what order it is).
I know that the following code can did it.
Msort <- t(apply(M, 1, sort))
duplicated(Msort)
I want to get this Logical vector:
> duplicated(Msort)
[1] FALSE TRUE FALSE TRUE FALSE TRUE
But if the matrix is large, say 10,000 rows and 10,000 columns, how to deal with this situation efficicently?
Thanks.