datetimes               package:ssBase               R Documentation

_C_a_l_c_u_l_a_t_e _D_a_t_e_s _a_n_d _T_i_m_e_s

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

     Calculates the number of days and fractions thereof from the 1
     January 1970.

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

     datetimes(year, month, day, hour, minute, second=0, dp.second=NA,
               missing = FALSE)

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

    year: an integer, e.g. 1998. 

   month: an integer with values 1, 2, ..., 12. 

     day: an integer giving the day of the month, e.g. 1, 2, ..., 31. 

    hour: an integer giving the hour of the day, i.e. 0, 1, 2, ..., 23. 

  minute: an integer giving the minute of the hour, i.e. 0, 1, 2, ...,
          59. 

  second: a numeric vector giving the seconds, e.g. 32.45. The number
          of decimal places should be consistent with dp.second below.
          Default is zero. 

dp.second: an integer giving the number of decimal places specified in
          second. Default is 'NA', i.e. not specified. In this case
          zero is used in all calculations. 

 missing: logical, default is 'FALSE'. Indicates whether information
          about the extent of missing values should be passed out of
          the function. 

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

     If 'missing' == 'FALSE', then only a datetimes object is returned.
     If 'TRUE', a list object which contains a datetimes object called
     'ti' and an object called 'missing' is returned.

     A datetimes object is a numeric vector with class '"datetimes"',
     and values for each date that are the number of days and fractions
     thereof from 00:00:00hrs on 1 January 1970. This object also has
     attributes '"origin"' which species the origin date, and
     '"dp.second"' which specifies the accuracy of the variable
     'second'. This information will determine the number of decimal
     places used to print the object. By default, the object will be
     printed in the format DDMMMYYYY hh:mm:ss.s, where the number of
     decimal places is specified as above.

     The vector 'missing' is character, taking values '"Y"', '"M"',
     '"D"', '"h"', '"m"', '"s"', corresponding to whether the 'year',
     'month', 'day', 'hour', 'minute' or 'second' is missing,
     respectively. Where more than one of these values are missing then
     'missing' takes the first one from 'c("Y", "M", "D", "h", "m",
     "s")'. When 'month' or 'day' is missing, one is used in
     calculations; and where 'hour', 'minute' or 'second' are missing,
     zero is used in calculations.

     The main difference with the 'chron' function in package 'chron'
     is that the 'datetimes' function has a facility to account for
     fractional seconds, and also missing values as described above.

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

     'format.datetimes', '[.datetimes', 'print.datetimes', 'years1',
     'months1', 'days1'

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

     a <- datetimes(1998, 6, 2, 13, 34, 25.9, dp.second=1)
     print(a)
     print.default(a)
     format(a)

