I am trying to figure out how to remove all unique rows, from a data frame, but if it has a duplicate, I want that to stay in. For Example - I want all columns from this wi
You can do this by creating an index with ave:
ave
df[as.logical(ave(1:nrow(df), df$col1, FUN=function(x) length(x) > 1)), ]
produces
col1 col2 col3 1 a A 3 2 a B 3 3 a C 1 6 d A 3 7 d B 2 8 d C 1