yearmon                package:chron                R Documentation

_C_o_n_v_e_r_t _m_o_n_t_h_l_y _o_r _q_u_a_r_t_e_r_l_y _d_a_t_a _t_o _c_h_r_o_n

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

     These functions can be used to convert the times of '"ts"' series
     with 'frequency' of 12 or 4 or objects of '"yearmon"' and
     '"yearqtr"' class, as defined in the '"zoo"' package, to 'chron'
     dates.

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

     ## S3 method for class 'yearmon':
     as.chron(x, frac = 0, holidays = FALSE, ...)
     ## S3 method for class 'yearqtr':
     as.chron(x, frac = 0, holidays = FALSE, ...)
     ## S3 method for class 'ts':
     as.chron(x, frac = 0, holidays = FALSE, ...)

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

       x: an object of class '"yearmon"' or '"yearqtr"' or '"ts"'
          objects, or a numeric vector interpreted "in years" and
          fractions of years.

    frac: Number between zero and one inclusive representing the
          fraction of the way through the month or quarter.

holidays: If 'TRUE' or a vector of chron dates, indicated holidays and
          weekends are excluded so the return value will be a
          non-holiday weekday.

     ...: Other arguments passed to 'chron'.

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

     The '"yearmon"' and '"yearqtr"' classes are defined in package
     'zoo'.  If 'holidays' is 'TRUE' or a vector of  dates then the
     'is.holiday' function is used to determine whether days are
     holidays.

     The method for ts objects converts the times corresponding to
     'time(x)' to chron.  The ts series must have a frequency that is a
     divisor of 12.

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

     Returns a 'chron' object.

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

     'is.holiday', 'ts'

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

     ## Monthly time series data.
     as.chron(AirPassengers)
     as.chron(time(AirPassengers))
     ## convert to first day of the month that is not a weekend or holiday
     as.chron(AirPassengers, frac = 0, holidays = TRUE)
     ## convert to last day of the month
     as.chron(AirPassengers, frac = 1)
     ## convert to last day of the month that is not a weekend or holiday
     as.chron(AirPassengers, frac = 1, holidays = TRUE)
     ## convert to last weekday of the month
     as.chron(AirPassengers, frac = 1, holidays = c())

     ## Quarterly time series data.
     as.chron(presidents)
     as.chron(time(presidents))

