Skip to content
Prev 366553 / 398502 Next

Delete the first instances of the unique values of a vector in R

Hello,

Just see the following.

x <- scan(text = "
1
4
4
4
4
4
4
6
6")
dat <- data.frame(x, y = rnorm(length(x)))

dat[-which(c(TRUE, dat$x[-1] != dat$x[-length(dat$x)])), ]

And now instead of 'dat' call your dataset 'rwrdatafile', and the same 
for the column of interess.

Hope this helps,

Rui Barradas

Em 10-01-2017 21:39, Tunga Kantarc? escreveu: