days                  package:chron                  R Documentation

_R_e_t_u_r_n _V_a_r_i_o_u_s _P_e_r_i_o_d_s _f_r_o_m _a _C_h_r_o_n _o_r _D_a_t_e_s _O_b_j_e_c_t

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

     Given a chron or dates object, extract the year, quarter, month,
     day (within the month) or weekday (days within the week) of the
     date it represents.

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

     days(x)
     ## Default S3 method:
     weekdays(x, abbreviate = TRUE)
     ## Default S3 method:
     months(x, abbreviate = TRUE)
     ## Default S3 method:
     quarters(x, abbreviate = TRUE)
     years(x)

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

       x: an object inheriting from class '"dates"', or coercible to
          such via 'as.chron'.

abbreviate: should abbreviated names be returned?  Default is 'TRUE'. 

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

     Note that 'months', 'quarters' and 'weekdays' are generics defined
     in package 'base' which also provides methods for objects of class
     '"Date"' as generated, e.g., by 'Sys.Date'.  These methods return
     character rather than factor variables as the default methods in
     'chron' do. To take advantage of the latter, Date objects can be
     converted to dates objects using 'as.chron', see the examples.

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

     an ordered factor corresponding to days, weekdays, months,
     quarters, or years of 'x' for the respective function.

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

     'is.weekend', 'is.holiday'

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

     dts <- dates("07/01/78") + trunc(50 * rnorm(30))
     plot(weekdays(dts))
     plot(months(dts))

     ## The day in the current timezone as a Date object.
     Dt <- Sys.Date()
     ## Using the months method for Date objects.
     months(Dt)
     ## Using the months default method.
     months(as.chron(Dt))

