Hello again,
Sorry about my first answer, I hadn't read until the part you say you
need a for loop. Why you need it seems strange to me but here it is.
delete <- c(TRUE, dat$x[-1] != dat$x[-length(dat$x)])
result <- data.frame()
for(i in seq_along(delete)){
if(!delete[i])
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,
Ru
I think you should probably go read some introductory material on R.
There are lots of good references out there. R does not work in the
same way as MATLAB.
You should probably also read the posting guide, and this article on
making good reproducible examples:
http://stackoverflow.com/questions/59
Consider a data frame which I name as rwrdatafile. It includes several
variables stored in columns. For each variable there are 1000
observations and hence 1000 rows. The interest lies in the values of
the second column of this data frame, that is in rwrdatafile[,2]. What
I am trying to accomplish
4 matches
Mail list logo