seq.POSIXt               package:base               R Documentation

_G_e_n_e_r_a_t_e _R_e_g_u_l_a_r _S_e_q_u_e_n_c_e_s _o_f _D_a_t_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     The method for 'seq' for date-time classes.

_U_s_a_g_e:

     ## S3 method for class 'POSIXt':
     seq(from, to, by, length.out = NULL, along.with = NULL, ...)

_A_r_g_u_m_e_n_t_s:

    from: starting date. Required.

      to: end date. Optional.

      by: increment of the sequence. Optional.  See 'Details'.

length.out: integer, optional. desired length of the sequence.

along.with: take the length from the length of this argument.

     ...: arguments passed to or from other methods.

_D_e_t_a_i_l_s:

     'by' can be specified in several ways.

        *  A number, taken to be in seconds.

        *  A object of class 'difftime'

        *  A character string, containing one of '"sec"', '"min"',
           '"hour"', '"day"', '"DSTday"', '"week"', '"month"' or
           '"year"'.  This can optionally be preceded by a (positive or
           negative) integer and a space, or followed by '"s"'.

     The difference between '"day"' and '"DSTday"' is that the former
     ignores changes to/from daylight savings time and the latter takes
     the same clock time each day.  ('"week"' ignores DST (it is a
     period of 144 hours), but '"7 DSTdays"') can be used as an
     alternative.  '"month"' and '"year"' allow for DST.)

     The timezone of the result is taken from 'from': remember than GMT
     does not have daylight savings time.

     Using '"month"' first advances the month without changing the day:
     if this results in an invalid day of the month, it is counted
     forward into the next month: see the examples.

_V_a_l_u_e:

     A vector of class '"POSIXct"'.

_S_e_e _A_l_s_o:

     'DateTimeClasses'

_E_x_a_m_p_l_e_s:

     ## first days of years
     seq(ISOdate(1910,1,1), ISOdate(1999,1,1), "years")
     ## by month
     seq(ISOdate(2000,1,1), by = "month", length.out = 12)
     seq(ISOdate(2000,1,31), by = "month", length.out = 4)
     ## quarters
     seq(ISOdate(1990,1,1), ISOdate(2000,1,1), by = "3 months")
     ## days vs DSTdays: use c() to lose the timezone.
     seq(c(ISOdate(2000,3,20)), by = "day", length.out = 10)
     seq(c(ISOdate(2000,3,20)), by = "DSTday", length.out = 10)
     seq(c(ISOdate(2000,3,20)), by = "7 DSTdays", length.out = 4)

