yearqtr                 package:zoo                 R Documentation

_A_n _I_n_d_e_x _C_l_a_s_s _f_o_r _Q_u_a_r_t_e_r_l_y _D_a_t_a

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

     '"yearqtr"' is a class for representing quarterly data.

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

     yearqtr(x)

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

       x: numeric (interpreted as being "in years").

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

     The yearqtr class is used to represent quarterly data. Internally
     it holds the data as year plus 0 for Quarter 1, 1/4 for Quarter 2
     and so on in order that its internal representation is the same as
      'ts' class with 'frequency = 4'. If 'x' is not in this format it
     is rounded via 'floor(4*x + .0001)/4'.

     There are coercion methods available for various classes
     including: default coercion to '"yearqtr"' (which coerces to
     '"numeric"' first) and coercion from '"yearqtr"' to '"Date"' (see
     below), '"POSIXct"', '"POSIXlt"', '"numeric"', '"character"'.

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

     Returns its argument converted to class 'yearqtr'.

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

     'yearmon', 'zoo', 'zooreg', 'ts'

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

     x <- yearqtr(2000 + seq(0, 7)/4)
     x

     # returned Date is the fraction of the way through
     # the period given by frac (= 0 by default)
     as.Date(x)
     as.Date(x, frac = 1)
     as.POSIXct(x)

     z <- zoo(rnorm(8), x, frequency = 4)
     z
     as.ts(z)

