While the primary purpose of this class and its methods is to allow code to me more robust with respect to other (and future) improved/different representations of time, the methods also provide a simple way to fix some inconsistency which may occur with the current mix of possible time representations.
The classes and methods associated with the implementation of rts, cts
and its in Splus accomplish some of these objectives. The attempt here
is further separate the time representation from the data to allow a
statement like
tframe(x) <- tframe(y)
to make the time frame of x the same as that of y, without the need to
worry about what time representation is used in y (eg. tsp, rts, cts,
its, ...). In this assignment x and y need not be too similar (eg - one
might be a univariate series while the other is a matrix or an array or
list of spatial or panel time series data), as long as they are similar
in the time dimension.
This is accomplished by assigning an attribute of the data called "tframe" and giving that attribute a class so that methods can be applied to it. Doing this in a generic way allows for the possibility of future classes of time representation. This is different from the way that rts, cts and its are implemented, in the sense that it is the tframe attribute of the data which is assigned a class indicating the time representation, not the data object itself.
The most general (last) class of the "tframe" attribute should be "tframe". The method "is.tframe" checks if an object is of class tframe, and the method "is.tframed" checks if an object has an attribute "tframe" of class tframe. In general, tframe methods act on the time frame (tframe) and tframed methods act on data which is tframed.
More specific methods can be defined for any special time representation (eg. below methods are defined for tframes of class c("tsp", "tframe") which are the old style tsp convention for time). Also, below, is an untested sketch of an implementaion for rts, cts, its and a class and methods style implementation of tsp called ts.
See the section "tframe methods" below for some methods which should be supported. In particular, start(), end(), and periods() should be supported methods for any object of class tframe. (and until I make a lot of changes in my code, frequency is important.)
One implication of the desire to be able to use a statement like tframe(x) <- tframe(y) is that the tframe should not indicate which dim of the data is the time dimension. In general this will have to be another attribute of the data, but the current convention of using the first dimension for matrix data and the length for vector data, makes it unnecessary to specify.
Operations which should be possible on tframe'd data: In the time dimension - window, splice In other dimensions -bind with shift to align the the tframe (and NA pad.start, pad.end, pad=T/F) - [] without losing the tframe