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)

