window                 package:base                 R Documentation

_T_i_m_e _W_i_n_d_o_w_s

_D_e_s_c_r_i_p_t_i_o_n:

     `window' is a generic function which extracts the subset of the
     object `x' observed between the times `start' and `end'. If a
     frequency is specified, the series is then re-sampled at the new
     frequency.

_U_s_a_g_e:

     window(x, ...)
     window.default(x, start = NULL, end = NULL,
                    frequency = NULL, deltat = NULL, extend = FALSE, ...)
     window.ts(x, start = NULL, end = NULL,
               frequency = NULL, deltat = NULL, extend = FALSE, ...)

_A_r_g_u_m_e_n_t_s:

       x: a time-series or other object.

   start: the start time of the period of interest.

     end: the end time of the period of interest.

frequency, deltat: the new frequency can be specified by either (or
          both if they are consistent).

  extend: logical. If true, the `start' and `end' values are allowed to
          extend the series. If false, attempts to extend the series
          give a warning and are ignored.

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

_D_e_t_a_i_l_s:

     The start and end times can be specified as for `ts'. If there is
     no observation at the new `start' or `end', the immediately
     following (`start') or preceding (`end') observation time is used.

_V_a_l_u_e:

     The value depends on the method. `window.default' will return a
     vector or matrix with an appropriate `tsp' attribute.

     `window.ts' differs from `window.default' only in ensuring the
     result is a `ts' object.

     If `extend = TRUE' the series will be padded with `NA' if needed.

_S_e_e _A_l_s_o:

     `time', `ts'.

_E_x_a_m_p_l_e_s:

     data(presidents)
     window(presidents, 1960, c(1969,4)) # values in the 1960's
     window(presidents, deltat=1)  # All Qtr1s
     window(presidents, start=c(1945,3), deltat=1)  # All Qtr3s
     window(presidents, 1944, c(1979,2), extend=TRUE)

