Re: [R] duplicated rows of a matrix

2014-07-21 Thread carol white
I need that duplicated indicate all row indices (occurences) that are duplicated. In your example, rows 2,3,4,5,8 Thanks. Carol On Monday, July 21, 2014 9:17 PM, William Dunlap wrote: Can you give an example of duplicated() not working on the rows of a matrix? Here is an example where i

Re: [R] duplicated rows of a matrix

2014-07-21 Thread William Dunlap
duplicated(x), for vector or matrix x, flags any value (row for matrices) previously seen in x. To flag all duplicated values (rows for matrices) you can use the following allDups() function. allDups <- function(x) duplicated(x) | duplicated(x, fromLast=TRUE) > In your example, rows 2,3,4,5,8

Re: [R] duplicated rows of a matrix

2014-07-21 Thread William Dunlap
Can you give an example of duplicated() not working on the rows of a matrix? Here is an example where it does work: > m <- cbind(c(a=1,b=2,c=3,d=2,e=3,f=4,g=1,h=1), c(11,13,11,13,11,13,13,11)) > class(m) [1] "matrix" > m [,1] [,2] a1 11 b2 13 c3 11 d2 13 e3 11 f

[R] duplicated rows of a matrix

2014-07-21 Thread carol white
Hi, is it possible to find the duplicated rows of a matrix without a loop or i have to loop over the rows? duplicated doesn't seem to be helpful Thanks Carol [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://st