EVOLUTION-MANAGER
Edit File: period.sum.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: Calculate Sum By Period</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 period.sum {xts}"><tr><td>period.sum {xts}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Calculate Sum By Period </h2> <h3>Description</h3> <p>Calculate a sum for each period of INDEX. Essentially a rolling application of sum over a series of non-overlapping sections. </p> <h3>Usage</h3> <pre> period.sum(x, INDEX) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p> a univariate data object </p> </td></tr> <tr valign="top"><td><code>INDEX</code></td> <td> <p> a numeric vector of endpoints to calculate sum on </p> </td></tr> </table> <h3>Details</h3> <p>Used to calculate a sum per period given an arbitrary index of sections to be calculated over. This is an optimized function for sum. There are additionally optimized versions for min, max, and prod. </p> <p>For xts-coercible objects, an appropriate INDEX can be derived from a call to <code>endpoints</code>. </p> <h3>Value</h3> <p>An <code>xts</code> or <code>zoo</code> object of sums, indexed by the period endpoints. </p> <h3>Author(s)</h3> <p> Jeffrey A. Ryan </p> <h3>See Also</h3> <p><code><a href="endpoints.html">endpoints</a></code>, <code><a href="period.max.html">period.max</a></code>, <code><a href="period.min.html">period.min</a></code>, <code><a href="period.prod.html">period.prod</a></code> </p> <h3>Examples</h3> <pre> period.sum(c(1,1,4,2,2,6,7,8,-1,20),c(0,3,5,8,10)) data(sample_matrix) period.sum(sample_matrix[,1],endpoints(sample_matrix)) period.sum(as.xts(sample_matrix)[,1],endpoints(sample_matrix)) </pre> <hr /><div style="text-align: center;">[Package <em>xts</em> version 0.12.2 <a href="00Index.html">Index</a>]</div> </body></html>