tframe                package:tframe                R Documentation

_E_x_t_r_a_c_t _o_r _S_e_t _a _t_f_r_a_m_e

_D_e_s_c_r_i_p_t_i_o_n:

     Extract or set the tframe of an object.

_U_s_a_g_e:

         tframe(x)
         ## Default S3 method:
         tframe(x)
         ## S3 method for class 'ts':
         tframe(x)

         tframe(x) <- value
         ## Default S3 method:
         tframe(x) <- value
         ## S3 method for class 'rts':
         tframe(x) <- value
         ## S3 method for class 'cts':
         tframe(x) <- value
         ## S3 method for class 'its':
         tframe(x) <- value
         ## S3 method for class 'ts':
         tframe(x) <- value

         tframed(x, tf=NULL, names = NULL)
         ## Default S3 method:
         tframed(x, tf = NULL, names = NULL)

         is.tframe(x)
         is.tframed(x)

_A_r_g_u_m_e_n_t_s:

       x: an object (to which a tframe is assigned in assignment
          methods).

   value: a tframe.

      tf: a tframe object or a tframed object from which a tframe is
          taken.

   names: optional vector of strings to specify new series names.

_D_e_t_a_i_l_s:

     The first usage returns the tframe of a tframed object. The
     assignment methods and tframed set the tframe of an object.
     '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.

_V_a_l_u_e:

     Depends.

_S_e_e _A_l_s_o:

     'tfstart', 'tfend', 'tffrequency', 'tfperiods', 'tftime', 'tfdiff'

_E_x_a_m_p_l_e_s:

         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)

