EVOLUTION-MANAGER
Edit File: index.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: Extracting/Replacing the Index 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 index {zoo}"><tr><td>index {zoo}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Extracting/Replacing the Index of Objects</h2> <h3>Description</h3> <p>Generic functions for extracting the index of an object and replacing it. </p> <h3>Usage</h3> <pre> index(x, ...) index(x) <- 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>...</code></td> <td> <p>further arguments passed to methods.</p> </td></tr> <tr valign="top"><td><code>value</code></td> <td> <p>an ordered vector of the same length as the <code>"index"</code> attribute of <code>x</code>.</p> </td></tr> </table> <h3>Details</h3> <p><code>index</code> is a generic function for extracting the index of objects, currently it has a default method and a method for <code><a href="zoo.html">zoo</a></code> objects which is the same as the <code><a href="../../stats/html/time.html">time</a></code> method for <code><a href="zoo.html">zoo</a></code> objects. Another pair of generic functions provides replacing the <code>index</code> or <code>time</code> attribute. Methods are available for <code>"zoo"</code> objects only, see examples below. </p> <p>The start and end of the index/time can be queried by using the methods of <code>start</code> and <code>end</code>. </p> <h3>See Also</h3> <p><code><a href="../../stats/html/time.html">time</a></code>, <code><a href="zoo.html">zoo</a></code></p> <h3>Examples</h3> <pre> suppressWarnings(RNGversion("3.5.0")) set.seed(1) x.date <- as.Date(paste(2003, 2, c(1, 3, 7, 9, 14), sep = "-")) x <- zoo(rnorm(5), x.date) ## query index/time of a zoo object index(x) time(x) ## change class of index from Date to POSIXct ## relative to current time zone x index(x) <- as.POSIXct(format(time(x)),tz="") x ## replace index/time of a zoo object index(x) <- 1:5 x time(x) <- 6:10 x ## query start and end of a zoo object start(x) end(x) ## query index of a usual matrix xm <- matrix(rnorm(10), ncol = 2) index(xm) </pre> <hr /><div style="text-align: center;">[Package <em>zoo</em> version 1.8-11 <a href="00Index.html">Index</a>]</div> </body></html>