EVOLUTION-MANAGER
Edit File: window.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Time Windows</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for window {stats}"><tr><td>window {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Time Windows</h2> <h3>Description</h3> <p><code>window</code> is a generic function which extracts the subset of the object <code>x</code> observed between the times <code>start</code> and <code>end</code>. If a frequency is specified, the series is then re-sampled at the new frequency. </p> <h3>Usage</h3> <pre> window(x, ...) ## S3 method for class 'ts' window(x, ...) ## Default S3 method: window(x, start = NULL, end = NULL, frequency = NULL, deltat = NULL, extend = FALSE, ...) window(x, ...) <- value ## S3 replacement method for class 'ts' window(x, start, end, frequency, deltat, ...) <- value </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>a time-series (or other object if not replacing values).</p> </td></tr> <tr valign="top"><td><code>start</code></td> <td> <p>the start time of the period of interest.</p> </td></tr> <tr valign="top"><td><code>end</code></td> <td> <p>the end time of the period of interest.</p> </td></tr> <tr valign="top"><td><code>frequency, deltat</code></td> <td> <p>the new frequency can be specified by either (or both if they are consistent).</p> </td></tr> <tr valign="top"><td><code>extend</code></td> <td> <p>logical. If true, the <code>start</code> and <code>end</code> values are allowed to extend the series. If false, attempts to extend the series give a warning and are ignored.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>further arguments passed to or from other methods.</p> </td></tr> <tr valign="top"><td><code>value</code></td> <td> <p>replacement values.</p> </td></tr> </table> <h3>Details</h3> <p>The start and end times can be specified as for <code><a href="ts.html">ts</a></code>. If there is no observation at the new <code>start</code> or <code>end</code>, the immediately following (<code>start</code>) or preceding (<code>end</code>) observation time is used. </p> <p>The replacement function has a method for <code>ts</code> objects, and is allowed to extend the series (with a warning). There is no default method. </p> <h3>Value</h3> <p>The value depends on the method. <code>window.default</code> will return a vector or matrix with an appropriate <code><a href="tsp.html">tsp</a></code> attribute. </p> <p><code>window.ts</code> differs from <code>window.default</code> only in ensuring the result is a <code>ts</code> object. </p> <p>If <code>extend = TRUE</code> the series will be padded with <code>NA</code>s if needed. </p> <h3>References</h3> <p>Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) <em>The New S Language</em>. Wadsworth & Brooks/Cole. </p> <h3>See Also</h3> <p><code><a href="time.html">time</a></code>, <code><a href="ts.html">ts</a></code>.</p> <h3>Examples</h3> <pre> 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) pres <- window(presidents, 1945, c(1949,4)) # values in the 1940's window(pres, 1945.25, 1945.50) <- c(60, 70) window(pres, 1944, 1944.75) <- 0 # will generate a warning window(pres, c(1945,4), c(1949,4), frequency = 1) <- 85:89 pres </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>