I'm trying to remove all duplicate values based on multiple variable using dplyr. Here's how I do it without dplyr:
dat = data.frame(id=c(1,1,2),date=c(1,1,1))
dat = dat[!(duplicated(dat[c('id','date')]) | duplicated(dat[c('id','date')],fromLast=TRUE)),]
It should only return id number 2.