Hi again, I was thinking that the interval would stop when there was a NA, ignore subsequent NAs and only start a new interval when there was a new value. So in the example below, the interval would stop at row 320, and a new interval started at row 334.
> head (D, 20) Salt time 319 35.63190 2004-07-26 320 35.66033 2004-07-27 321 NA 2004-07-28 322 NA 2004-07-29 323 NA 2004-07-30 324 NA 2004-07-31 325 NA 2004-08-01 326 NA 2004-08-02 327 NA 2004-08-03 328 NA 2004-08-04 329 NA 2004-08-05 330 NA 2004-08-06 331 NA 2004-08-07 332 NA 2004-08-08 333 NA 2004-08-09 334 35.57781 2004-08-10 335 35.59829 2004-08-11 Many thanks, Helene -- View this message in context: http://r.789695.n4.nabble.com/Help-with-loop-tp4650313p4650432.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.