epidate               package:epitools               R Documentation

_C_o_n_v_e_r_t _d_a_t_e_s _i_n_t_o _m_u_l_t_i_p_l_e _l_e_g_i_b_l_e _f_o_r_m_a_t_s

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

     Convert character vector of dates into multiple legible formats.

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

     epidate(x, format = "%m/%d/%Y", cal.dates = FALSE,
             before = 7, after = 7, sunday = TRUE)

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

       x: character vector of dates to be converted

  format: format of character vector of dates

cal.dates: Calendar dates that contains 'x', starting 7 days 'before'
          (default) until 7 days 'after' 'x'

  before: defines lower limit of 'cal.dates': default is 7 days before
          earliest date in 'x'

   after: defines upper limit of 'cal.dates': default is 7 days after
          latest date in 'x'

  sunday: first day of the week is either Sunday (default) or Monday

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

     Dates can come in many formats (e.g., November 12, 2001, 12Nov01,
     11/12/2001, 11/12/01, 2001-11-12) and need to be converted into
     other formats for data analysis, graphical displays, generating
     reports, etc.

     There is tremendous flexibility in converting any character vector
     with sufficient information to be converted into a unique date.
     For complete options for the 'format' option see 'strptime'.

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

   dates: dates wtih date-time class

  julian: number of days since 1970-01-01

    mday: day of the month: 1-31

     mon: month of the year: 0-11

   month: month: January, February, March, ...

  month2: month: Jan, Feb, Mar, ...

firstday: first day of the week: Sunday or Monday

    week: week of the year: 0-53

    year: year: YYYY

      yr: year: YY

    wday: day of the week: 0-6

 weekday: weekday: Monday, Tuesday, Wednesday, ...

   wkday: weekday: Mon, Tue, Wed, ...

    yday: day of the year: 0-365

 quarter: quarter of the year: Q1, Q2, Q3, Q4

  cdates: Calendar dates that contains 'dates'

 cjulian: Julian calendar dates

_N_o_t_e:

     Visit <URL: http://www.epitools.net> for the latest.

_A_u_t_h_o_r(_s):

     Tomas Aragon, aragon@berkeley.edu, <URL: http://www.medepi.com>

_R_e_f_e_r_e_n_c_e_s:

     none

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

     'epitools': 'as.week'

     'DateTimeClasses' to learn about date-time classes

     'as.Date' to convert character vector of dates into calendar dates
     with date-time class (done by 'epidate')

     'strptime' to convert date-time character strings into a date-time
     class 

     'format.POSIXlt' or 'format.POSIXlt' to convert date-time classes
     into character representations

     'as.POSIXlt' to convert either date-time objects or date-time
     character strings into a human legible date-time class (done by
     'epidate') 

     'as.POSIXct' to convert either date-time objects or date-time
     character strings into a continuous time date-time class (not done
     by 'epidate') 

     'weekdays', 'months', 'quarters', or 'julian', to convert
     date-time objects into weekdays, months, quarters, or julian
     representations, respectively (all are done by 'epidate')

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

     #x <- c("12/1/03", "11/2/03", NA, "1/7/04", "1/14/04", "8/18/04")
     #epidate(x, format = "%m/%d/%y")
     #epidate(x, format = "%m/%d/%y", TRUE)
     #
     ###convert vector of disease weeks into vector of mid-week dates
     #dwk <- sample(0:53, 100, replace = TRUE)
     #wk2date <- paste(dwk, "/", "Wed", sep="")
     #wk2date[1:10]
     #wk2date2 <- epidate(wk2date, format = "%U/%a")
     #wk2date2$dates[1:20]

