search for: duplicated2

Displaying 1 result from an estimated 1 matches for "duplicated2".

Did you mean: duplicated
2012 Jul 23
1
duplicated() variation that goes both ways to capture all duplicates
...02 5.8 2.7 5.1 1.9 virginica 143 5.8 2.7 5.1 1.9 virginica Unfortunately this is unnecessarily long and convoluted. Short of a 'bothWays' argument in duplicated(), I came up with a small wrapper that simplifies the above: duplicated2 <- function(x, bothWays=TRUE, ...) { if(!bothWays) { return(duplicated(x, ...)) } else if(bothWays) { return((duplicated(x, ...) | duplicated(x, fromLast=TRUE, ...))) } } Now the above can be achieved simply via: > iris[duplica...