Engeland, Tom van
2006-Oct-27 08:03 UTC
[R] problem with applying regul function (pastecs)
Hi,
I'm trying to analyse some time series data on dissolved organic
nitrogen. Because it has gaps in it, I try to interpolate (linear) with
the regul method from the pastecs package.
I have a number of stations with measurement series in a matrix
constructed from a data frame with the unstack method (temp)
I also used the unstack method to make a similar matrix for the time
points (time)
Now I have two matrices with the names of the stations as column
headers. The form is the same (35 cols, 192 rows) but the first one has
time points and the other the actual measurements.
I would like to get a data frame of the same form but with the
regularized time series through the regul method.
For this I used the following command:
timeseries <-
regul(c(time[,1]),as.data.frame(temp),deltat=1/12,units="years",methodsc("linear"))
At first this seems to work but if I recall timeseries I get the
following output on the screen:
> timeseries
Regulation of, by "method" :
Error in "names<-.default"(`*tmp*`, value =
c("Blauwe.Slenk.oost",
"Bocht.van.Watum", :
'names' attribute [35] must be the same length as the vector [1]
According to the reference manual I have to give a vector with time
points (time[,1]) as the first variable 'x' and a data frame/matrix
(as.data.frame(temp)) as the second variable 'y'.
The lengths of the columns of the data frame and of the vector are the
same.
What am I doing wrong? Thanks in advance for the feedback.
Cheers,
Tom
Tom Van Engeland
NIOO-CEME
P.O. Box 140
4400 AC Yerseke
The Netherlands
Phone: +31 (0)113 577 473
Mobile: +31 (0)6 205 217 33
E-mail: t.vanengeland@nioo.knaw.nl
[[alternative HTML version deleted]]
