Re: [R] finding row duplicates, regardless of element order

2011-10-30 Thread jim holtman
try this: > 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" > # not the most efficient > M.sorted <- apply(M, 1, function(x) paste(sort(x), co

[R] finding row duplicates, regardless of element order

2011-10-30 Thread Wet Bell Diver
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" an