Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You probably want to re-use existing facitlities, specifically the <code>POSIXct</code> time types, as well as existing packages.</p> <p>For example, look at the <a href="http://cran.r-project.org/package=xts" rel="nofollow">xts</a> package --- it already has a generic function <code>to.period()</code> as well as convenience wrappers <code>to.minutes()</code>, <code>to.minutes3()</code>, <code>to.minutes10()</code>, ....</p> <p>Here is an example from the help page:</p> <pre><code>R&gt; example(to.minutes) t.mn10R&gt; data(sample_matrix) t.mn10R&gt; samplexts &lt;- as.xts(sample_matrix) t.mn10R&gt; to.monthly(samplexts) samplexts.Open samplexts.High samplexts.Low samplexts.Close Jan 2007 50.0398 50.7734 49.7631 50.2258 Feb 2007 50.2245 51.3234 50.1910 50.7709 Mar 2007 50.8162 50.8162 48.2365 48.9749 Apr 2007 48.9441 50.3378 48.8096 49.3397 May 2007 49.3457 49.6910 47.5180 47.7378 Jun 2007 47.7443 47.9413 47.0914 47.7672 t.mn10R&gt; to.monthly(sample_matrix) sample_matrix.Open sample_matrix.High sample_matrix.Low sample_matrix.Close Jan 2007 50.0398 50.7734 49.7631 50.2258 Feb 2007 50.2245 51.3234 50.1910 50.7709 Mar 2007 50.8162 50.8162 48.2365 48.9749 Apr 2007 48.9441 50.3378 48.8096 49.3397 May 2007 49.3457 49.6910 47.5180 47.7378 Jun 2007 47.7443 47.9413 47.0914 47.7672 t.mn10R&gt; str(to.monthly(samplexts)) An ‘xts’ object from Jan 2007 to Jun 2007 containing: Data: num [1:6, 1:4] 50 50.2 50.8 48.9 49.3 ... - attr(*, "dimnames")=List of 2 ..$ : NULL ..$ : chr [1:4] "samplexts.Open" "samplexts.High" "samplexts.Low" "samplexts.Close" Indexed by objects of class: [yearmon] TZ: xts Attributes: NULL t.mn10R&gt; str(to.monthly(sample_matrix)) num [1:6, 1:4] 50 50.2 50.8 48.9 49.3 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:6] "Jan 2007" "Feb 2007" "Mar 2007" "Apr 2007" ... ..$ : chr [1:4] "sample_matrix.Open" "sample_matrix.High" "sample_matrix.Low" "sample_matrix.Close" R&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload