EVOLUTION-MANAGER
Edit File: timeBasedSeq.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: Create a Sequence or Range of Times</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 timeBasedSeq {xts}"><tr><td>timeBasedSeq {xts}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Create a Sequence or Range of Times </h2> <h3>Description</h3> <p>A function to create a vector of time-based objects suitable for indexing an <em>xts</em> object, given a string conforming to the ISO 8601 time and date standard for range-based specification. The resultant series can be of any class supported by <em>xts</em>, including POSIXct, Date, chron, timeDate, yearmon, and yearqtr. </p> <p><code>timeBasedRange</code> creates a vector of length 1 or 2 as seconds since the epoch (1970-01-01) for use internally. </p> <h3>Usage</h3> <pre> timeBasedSeq(x, retclass = NULL, length.out = NULL) timeBasedRange(x, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p> a string representing the time-date range desired </p> </td></tr> <tr valign="top"><td><code>retclass</code></td> <td> <p> the return class desired </p> </td></tr> <tr valign="top"><td><code>length.out</code></td> <td> <p> passed to <code>seq</code> internally </p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p> unused </p> </td></tr> </table> <h3>Details</h3> <p>Designed to provide uniform creation of valid time-based objects for use within <em>xts</em>, the interface conforms (mostly) to the ISO recommended format for specifying ranges. </p> <p>In general, the format is a string specifying a time and/or date <em>from</em>, <em>to</em>, and optionally <em>by</em> delineated by either ‘"/"’ or ‘"::"’. </p> <p>The first argument need not be quoted, as it is converted internally if need be. </p> <p>The general form is <em>from/to/by</em> or <em>from::to::by</em>, where <em>to</em> and <em>by</em> are optional if the length.out arg is specified. </p> <p>The <code>from</code> and <code>to</code> elements of the string must be left-specified with respect to the standard <em>CCYYMMDD HHMMSS</em> form. All dates-times specified will be set to either the earliest point (from) or the latest (to), given the level of specificity. </p> <p>For example ‘1999’ in the <em>from</em> field would set the start to the beginning of 1999. The opposite occurs in the <em>to</em> field. </p> <p>The level of detail in the request is interpretted as the level of detail in the result. The maximum detail of either <em>from</em> or <em>to</em> is the basis of the sequence, unless the optional <em>by</em> element is specified, which will be covered later. </p> <p>To request a yearly series, it is only necessary to use ‘"1999/2008"’. Alternately, one could request a monthly series (returned by default as class <code>yearmon</code>) with ‘"199901/2008"’ or ‘"1999-01/2008"’, or even ‘"1999/2008-01"’. As the level of granularity increases, so does the resultant sequence granularity - as does its length. </p> <p>Using the optional third <em>by</em> field (the third delimited element to the string), will override the granularity intepretation and return the requested periodicity. The acceptable arguments include <code>Y</code> for years, <code>m</code> for months, <code>d</code> for days, <code>H</code> for hours, <code>M</code> for minutes and <code>S</code> for seconds. </p> <h3>Value</h3> <p>A sequence or range of time-based objects. </p> <p>If <code>retclass</code> is <code>NULL</code>, the result is a named list of from, to, by and length.out. </p> <h3>Author(s)</h3> <p> Jeffrey A. Ryan </p> <h3>References</h3> <p> International Organization for Standardization: ISO 8601 <a href="https://www.iso.org">https://www.iso.org</a></p> <h3>See Also</h3> <p><code><a href="timeBased.html">timeBased</a></code>, <code><a href="xts.html">xts</a></code> </p> <h3>Examples</h3> <pre> timeBasedSeq('1999/2008') timeBasedSeq('199901/2008') timeBasedSeq('199901/2008/d') timeBasedSeq('20080101 0830',length=100) # 100 minutes timeBasedSeq('20080101 083000',length=100) # 100 seconds </pre> <hr /><div style="text-align: center;">[Package <em>xts</em> version 0.12.2 <a href="00Index.html">Index</a>]</div> </body></html>