[R] High frequency time-series
Achim Zeileis
zeileis at ci.tuwien.ac.at
Wed Oct 22 17:06:01 CEST 2003
On Wednesday 22 October 2003 15:09, v.demart at libero.it wrote:
> Having to collect hourly electricity loads and quarter-of-an-hour
> electricity production data for some years I think that the tidiest
> way of doing it is to resort to ts but I don't know how to define
> such a frequency starting from a set date.
>
> Leafing through r-help mail archives I've found this *ALMOST*
> satisfactory message:
> ==========================================================
> .........
>
> > I have a series of hourly rainfall and quarterly flow
> >
> > measurements (i.e. 4 times an hour) of a catchment
>
> ........
>
> > Maybe time series are easier, but in
> >
> > ts(data = NA, start = X,...
> >
> > X should be a number or a vector. how does this coresponds to a
> > data and hour (e.g. april 26,2002, 15:00:00)?
>
> If your observations are equidistant, e.g. you've got 24 hourly
> measurements per day, you could do something like this for the above
> example:
>
>
> R> rain <- ts(rain, start = c(26, 15), freq = 24)
> R> flow <- ts(flow, start = c(26, 15), freq = 96)
> ...........
> ============================================================
>
> But how does R know that we are speaking of a timeseries starting
> from April 26, 2002 and not, say, Feb 26, 2000? There's some piece
> of info missing in the answer.
Two possibilities:
- ts(): you can just have a single number which counts the
time unit. So you have to do that in a unique way. Either
by convention or e.g. by augmenting the ts object by an
additional attribute which gives the start date or something
in that direction.
- irts(): this is a function for definin irregularly spaced
time series and it's available in the package "tseries". The
time attribute is a vector of POSIXct times. This is more
flexible in some sense, but requires the storage of more
information. Furthermore, you have more functions around which
can compute objects of interest based on "ts" object than on
"irts" objects.
hth,
Z
> Am I correct?
> Please help.
>
> Ciao from Rome
>
> Vittorio
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list