tojulian                package:CTFS                R Documentation

_C_o_n_v_e_r_t_s _C_a_l_e_n_d_a_r _D_a_t_e_s _t_o _J_u_l_i_a_n _D_a_t_e_s _a_n_d _B_a_c_k

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

     These two functions can be used to convert dates to and from
     julian  formats for computations.  There are many functions that
     do this but these are useful for CTFS.  The functions rely upon
     functions found  in the R package *survival*.

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

     tojulian(x, dateform = "%m/%d/%Y", centurycut = 2020)
     fromjulian(j, dateform = "%m/%d/%Y")

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

       x: calendate date in the default format "m/d/yyyy".  The year
          should be specified with the century included, eg.
          "12/4/1999"

       j: the number of days since 1/1/1960

dateform: format for calendar date, see 'strptime' for format
          information

centurycut: years after this date are assumed to be in the 21st century

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

     These functions are dependent upon the package *survival*.  They
     use the functions 'mdy.date' and 'date.mmddyyy'.

     The results of 'tojulian' is a number of days, so it is an integer
     and can be used for computation.

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

'tojulian': returns an integer, the number of days since 1/1/1960
          formatted as d/m/y where d = day, m = 3 letter abreviation
          for month  eg Jan, Feb, Mar..., and y = year.

'fromjulian': returns a calendar date in mm/dd/yyyy format

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

     Rick Condit

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

     depends on the package *survival*

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

     'CTFS.utilities'

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

     ## Not run: 
     1.  tojulian()

     x1="3/5/1987"
     x2="3/5/2001"
     y1 <- tojulian(x1)
     y2 <- tojulian(x2)
     str(y1)
     str(y2)
     y2-y1

     2.  fromjulian()
     fromjulian(9925)
     fromjulian(15039)
     fromjulian(y1+(y2-y1))
       ## End(Not run)

