Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

How to remove duplicates based on the combinations of two columns r

# example
df = expand.grid(A = c('a', 'b', 'c', 'd'),
                 B = c('a', 'b', 'c', 'd'))

# remove redundant combinations
df[!duplicated(data.frame(t(apply(df,1,sort)))),]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #remove #duplicates #based #combinations #columns
ADD COMMENT
Topic
Name
3+9 =