tframe(x)
## S3 method for class 'default':
tframe(x)
## S3 method for class 'ts':
tframe(x) tframe(x) <- value
## S3 method for class 'default':
tframe(x) <- value ## S3 method for class 'ts':
tframe(x) <- value
tframed(x, tf=NULL, names = NULL)
## S3 method for class 'default':
tframed(x, tf = NULL, names = NULL)
is.tframe(x)
is.tframed(x)
is.tframe
returns
a logical.
The pure tframe approach is to set a "tframe" attribute for an object. This
attribute has a class which indicates the time framing which is used. The
the time frame information is often secondary, in the sense that it does not
describe the object structure, but only provides some additional information
which is useful for doing time based operations on the data, plotting, and
printing the object. By putting this in
an attribute, the objects class can be used for indicating other
information about the structure of the object. For
these pure tframe objects the default tframe
and code{tframe<-} will
often be adequate. The generic/method approach allows for special case (like
TSdata where the tframe information is not an attribute of the object, but
rather an attribute of the data matrices which are elements of the object).The generic/method approach also allows for (faking) tframe assignment and extraction with classes like rts, ctc, its, ts, and others which may appear, that try to make the time description part of the object class. (Not a "tframe" approach.) The problem is to extract real tframes and also fake these other classes and old style tsp objects so they look like tfamed objects. Another approach would be to mutilate these objects and force them really be tframed objects (to have a tframe attribute), but that risks conflicting with other (non tframe) code which used the objects. This faking is accomplished by specific methods of the classes, and for old style tsp objects it is built into the default.
This tframed
constructor is simply a shortcut for assigning the tframe
(tframe(x) <- tf) and series names (seriesNames(x) <- names) to an object,
but never assigns NULL values, so the result is guaranteed to be a
code{tframed} object. It is like ts
but enables the tframe library's
methods for handling time. If the tf
argument is a
tframed
object rather than a tframe
, then the code{tframe}
is extracted and used. If the names
argument is not mode "character"
of appropriate length, then seriesNames(names)
is used. These make it
simple to assign the time frame and names of one object to another by
z <- tframed(x, tf=y, names=y)
.
is.tframed
returns TRUE if a
tframe()
can extract a tframe from the object. This is true for many
objects which are not truly tframed (like ts objects), since tframe()
tries fairly hard to build a tframe for the object.
tfstart
,
tfend
,
tffrequency
,
tfperiods
,
tftime
,
tfdiff
z <- tframe(ts(rnorm(100), start=c(1982,1), frequency=12))
is.tframe(z)
zz <- tframed(matrix(rnorm(200), 100,2), tf=z)
is.tframed(zz)
zzz <- tframed(matrix(rnorm(200), 100,2), tf=zz)
is.tframed(zzz)
tframe(zzz)
Run the code above in your browser using DataLab