I have a data frame that I want to remove duplicates that are consecutive (in base). I know rle may be helpful here but can\'t think of how to use it. The exa
rle
Here's a way, not with rle, but a way none-the-less:
dat[with(dat, c(TRUE, diff(as.numeric(interaction(v1, v2))) != 0)), ]
This assumes you're using factor columns, as your sample data implies.
factor