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
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
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
3 matches
Mail list logo