search for: xdup1

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

Did you mean: xdp1
2005 Mar 18
3
extract rows in dataframe with duplicated column values
...I want to extract all the rows in a data frame that have duplicates for a given column. I would expect this question to come up pretty often but I have researched the archives and surprisingly couldn't find anything. The best I can come up with is: x <- data.frame(a=c(1,2,2,3,3,3), b=10) xdup1 <- duplicated(x[,1]) xdup2 <- duplicated(x[,1][nrow(x):1])[nrow(x):1] xAllDups <- x[(xdup1+xdup2)!=0,] This seems to work, but it's so convoluted that I'm sure there's a better method. Thanks for any help and enlightenment [[alternative HTML version deleted]]