window                 package:stats                 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, ...)

     ## S3 method for class 'ts':
     window(x, ...)

     ## Default S3 method:
     window(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.

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

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

_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)

