[R] Calculating seasonal anomalies

2013-02-18 Thread Hefri
I have an irregular time series, which cannot easily be converted to a ts object (long stretches with NA). I have calculated the climatological mean and st.dev, but need help on how to calculate the anomalies from the climatology and my original data set. Below is an example, where I have indi

Re: [R] Help with loop

2012-11-22 Thread Hefri
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

[R] Help with loop

2012-11-21 Thread Hefri
Hi, I have used R for some time, but managed to avoid writing loops. But this time I am afraid there is no way around it. I have a dataframe with time and salinity (see below). I would like to extract the time intervals where salinity changes by less than 0.05. So using the values below this wo