[R] Array as time series?

Timothy H. Keitt tklistaddr at keittlab.bio.sunysb.edu
Fri Sep 7 17:16:19 CEST 2001


It would be nice to have a more general time series data structure, 
e.g., for 2D spatial PDE solutions and so on.  This could easily be done 
by using the "array" type for data storage, and then making the 
convention that the 5 dimensions represent time, x, y, z, variable.

mdts <- function(x, dimensions, start, end, frequency) {

    out <- array(x, d)
    attr(out, "tsp") <- c(start, end, frequency)
    class(out) <- "mdts"

    return(out)

}

x <- mdts(1, c(10, 3, 3, 1, 2), 1, 10, 1) # 10 time steps of 3x3 grids 
with 2 observations per cell

T.

Cowpertwait, Paul wrote:

>If your data is a bit like rainfall at multiple sites, I could probably
>offer some comments (assuming (x,y,z,t) is location and time?), although I
>don't know how useful they will be for your particular application.
>
>My (limited) experience is that R will do quite a lot up to bivariate time
>series (e.g. ccf function), but beyond that you need to write your own code.
>This could be in R, but may be more appropriate in a fully compiled language
>(like C or Fortran) if you have a large data set (because R is too slow for
>heavy number crunching work; although it appears to be faster than S-Plus).
>
>
>Again I'm not sure whether this is relevant for your data set, but a fairly
>common approach with climatological data is to attempt to reduce the
>dimensions using principle components.  I understand PCA functions exist in
>R, although I've never used them.  Depending on your data this approach may
>simplify the problem.  
>
>
>-----Original Message-----
>From: Christian Georges [mailto:christian.georges at uibk.ac.at]
>Sent: Friday, 7 September 2001 02:48
>To: r-help at stat.math.ethz.ch; Christian Georges
>Subject: [R] Array as time series?
>
>
>Dear R-helpers,
>
>I have 4-dimensional atmospheric data (x,y,z,t), which I want to analyse
>on spatio-temporal diversities.
>As far as I understand there only exists the possibility to construct
>time series as two-dimensional matrices (mts).
>For the moment, I hold it in different objects:
>
>1. a four-dimensional array for the spatial related analyses
>2. a two-dimensional mts timeserie, which was derived from 1. by
>computing spatial means.
>
>But, still this doesn't help for combined spatio-temporal analysis.
>
>One could regard the time dimension as just another linearily spaced
>dimension in the four-dimensional array, but when it comes analyses and
>graphics output it gets complicated, since one can't use all timeseries
>(ts-) related functions (require ts attributes).
>
>Could you provide me some comments, workarounds or your experiences on
>similar problems.
>
>Thanks in advance,
>
>Christian
>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
>Send "info", "help", or "[un]subscribe"
>(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
>_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
Timothy H. Keitt
Department of Ecology and Evolution
State University of New York at Stony Brook
Stony Brook, New York 11794 USA
Phone: 631-632-1101, FAX: 631-632-7626
http://life.bio.sunysb.edu/ee/keitt/



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list