EVOLUTION-MANAGER
Edit File: window.zoo.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: Extract/Replacing the Time Windows of Objects</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.zoo {zoo}"><tr><td>window.zoo {zoo}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Extract/Replacing the Time Windows of Objects</h2> <h3>Description</h3> <p>Methods for extracting time windows of <code>"zoo"</code> objects and replacing it. </p> <h3>Usage</h3> <pre> ## S3 method for class 'zoo' window(x, index. = index(x), start = NULL, end = NULL, ...) ## S3 replacement method for class 'zoo' window(x, index. = index(x), start = NULL, end = NULL, ...) <- value </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>an object.</p> </td></tr> <tr valign="top"><td><code>index.</code></td> <td> <p>the index/time window which should be extracted.</p> </td></tr> <tr valign="top"><td><code>start</code></td> <td> <p>an index/time value. Only the indexes in <code>index</code> which are greater or equal to <code>start</code> are used. If the index class supports comparisons to character variables, as does <code>"Date"</code> class, <code>"yearmon"</code> class, <code>"yearqtr"</code> class and the <code>chron</code> package classes <code>"dates"</code> and <code>"times"</code> then <code>start</code> may alternately be a character variable.</p> </td></tr> <tr valign="top"><td><code>end</code></td> <td> <p>an index/time value. Only the indexes in <code>index</code> which are lower or equal to <code>end</code> are used. Similar comments about character variables mentioned under <code>start</code> apply here too.</p> </td></tr> <tr valign="top"><td><code>value</code></td> <td> <p>a suitable value object for use with <code>window(x)</code>.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>currently not used.</p> </td></tr> </table> <h3>Value</h3> <p>Either the time window of the object is extracted (and hence return a <code>"zoo"</code> object) or it is replaced. </p> <h3>See Also</h3> <p><code><a href="zoo.html">zoo</a></code></p> <h3>Examples</h3> <pre> suppressWarnings(RNGversion("3.5.0")) set.seed(1) ## zoo example x.date <- as.Date(paste(2003, rep(1:4, 4:1), seq(1,19,2), sep = "-")) x <- zoo(matrix(rnorm(20), ncol = 2), x.date) x window(x, start = as.Date("2003-02-01"), end = as.Date("2003-03-01")) window(x, index = x.date[1:6], start = as.Date("2003-02-01")) window(x, index = x.date[c(4, 8, 10)]) window(x, index = x.date[c(4, 8, 10)]) <- matrix(1:6, ncol = 2) x ## for classes that support comparisons with "character" variables ## start and end may be "character". window(x, start = "2003-02-01") ## zooreg example (with plain numeric index) z <- zooreg(rnorm(10), start = 2000, freq = 4) window(z, start = 2001.75) window(z, start = c(2001, 4)) ## replace data at times of d0 which are in dn d1 <- d0 <- zoo(1:10) + 100 dn <- - head(d0, 4) window(d1, time(dn)) <- coredata(dn) ## if the underlying time index is a float, note that the index may ## print in the same way but actually be different (e.g., differing ## by 0.1 second in this example) zp <- zoo(1:4, as.POSIXct("2000-01-01 00:00:00") + c(-3600, 0, 0.1, 3600)) ## and then the >= start and <= end may not select all intended ## observations and adding/subtracting some "fuzz" may be needed window(zp, end = "2000-01-01 00:00:00") window(zp, end = as.POSIXct("2000-01-01 00:00:00") + 0.5) </pre> <hr /><div style="text-align: center;">[Package <em>zoo</em> version 1.8-11 <a href="00Index.html">Index</a>]</div> </body></html>