<p>A brand new <a href="http://dirk.eddelbuettel.com/code/anytime.html">anytime</a> package just arrived at <a href="https://cran.r-project.org/">CRAN</a>. This is release number eight, evenly spread with over two per month, since the initial release in September. Needless to say I have been told off not to make this many releases. As they say, no good deed goes unpunished.</p>
<p><a href="http://dirk.eddelbuettel.com/code/anytime.html">anytime</a> is a very focused package aiming to do just one thing really well: to convert anything in integer, numeric, character, factor, ordered, ... format to either POSIXct or Date objects -- and to do so without requiring a format string. See the <a href="http://dirk.eddelbuettel.com/code/anytime.html">anytime</a> page, or the <a href="https://github.com/eddelbuettel/anytime">GitHub README.md</a> for a few examples.</p>
<p>This releases does a few things:</p>
<ul><li>It fixes a misfeature apparent in some timezones: <code>anydate()</code> would somehow wrap around and return the previous day by accident. This has been addressed by moving the conversion to date directly into the C++ side of things.</li>
<li>New format helpers were added to format datetime or dates objects according to ISO 7601, RFC 2822 or RFC 3339 (see examples below).</li>
<li>Testing is now more stringent with actual comparisons to equivalent base R results; that way we are get getting bitten by different timezones.</li>
</ul><p>The following is a quick illustration</p>
<div><pre><code>R><span> </span><span>library</span>(anytime)
R><span> </span>p &lt;-<span> </span><span>anytime</span>(<span>&quot;2010-01-02 03:04:05.123456&quot;</span>)
R><span> </span>p
[<span>1</span>] <span>&quot;2010-01-02 03:04:05.123456 CST&quot;</span>
R><span> </span><span>iso8601</span>(p)
[<span>1</span>] <span>&quot;2010-01-02 03:04:05&quot;</span>
R><span> </span><span>rfc2822</span>(p)
[<span>1</span>] <span>&quot;Sat, 02 Jan 2010 03:04:05.123456 -0600&quot;</span>
R><span> </span><span>rfc3339</span>(p)
[<span>1</span>] <span>&quot;2010-01-02T03:04:05.123456-0600&quot;</span>
R><span> </span></code></pre></div>
<p>For symmetry, it also works for dates, but is less detailed</p>
<div><pre><code>R><span> </span>jl &lt;-<span> </span><span>anydate</span>(<span>&quot;July 04, 1789&quot;</span>)
R><span> </span>jl
[<span>1</span>] <span>&quot;1789-07-04&quot;</span>
R><span> </span><span>iso8601</span>(jl)
[<span>1</span>] <span>&quot;1789-07-04&quot;</span>
R><span> </span><span>rfc2822</span>(jl)
[<span>1</span>] <span>&quot;Sat, 04 Jul 1789&quot;</span>
R><span> </span><span>rfc3339</span>(jl)
[<span>1</span>] <span>&quot;1789-07-04&quot;</span>
R><span> </span></code></pre></div>
<p>Of course, all commands are also fully vectorised. See the <a href="http://dirk.eddelbuettel.com/code/anytime.html">anytime</a> page, or the <a href="https://github.com/eddelbuettel/anytime">GitHub README.md</a> for more examples.</p>
<blockquote>
<h4>Changes in anytime version 0.2.0 (2016-12-24)</h4>
<ul><li><p>Added (exported) helper functions iso8601(), rfc2822() and rfc3339() to format date(time) objects according to standards</p></li>
<li><p>Conversion to dates is now more robust thanks to improved internal processing (PR <a href="https://github.com/eddelbuettel/anytime/pull/39">#39</a> closing <a href="https://github.com/eddelbuettel/anytime/issues/36">#36</a>)</p></li>
<li><p>The ISO 8601 format is now recognised, however the timezone information is not parsed by Boost Date_Time (which is a known upstream limitation) (PR <a href="https://github.com/eddelbuettel/anytime/pull/38">#38</a> closing <a href="https://github.com/eddelbuettel/anytime/issues/37">#37</a>)</p></li>
<li><p>The 'allFormats.R' test script was significantly strengthened (<a href="https://github.com/eddelbuettel/anytime/pull/40">#40</a>)</p></li>
<li><p>Test scripts like 'simpleTests.R' have as also been strengthened (<a href="https://github.com/eddelbuettel/anytime/pull/41">#41</a>); on Windows and in one file two tests need to be skipped.</p></li>
<li><p>A new 'bulkTest.R' test script was added testing parsing against what R returns</p></li>
</ul></blockquote>
<p>Courtesy of <a href="http://dirk.eddelbuettel.com/cranberries/">CRANberries</a>, there is a comparison to <a href="http://dirk.eddelbuettel.com/cranberries/2016/12/24#anytime_0.2.0">the previous release</a>. More information is on the <a href="http://dirk.eddelbuettel.com/code/anytime.html">anytime</a> page.</p>
<p>For questions or comments use the <a href="https://github.com/eddelbuettel/anytime/issues">issue tracker</a> off the <a href="https://github.com/eddelbuettel/anytime">GitHub repo</a>.</p>
<p>
This post by <a href="http://dirk.eddelbuettel.com/">Dirk Eddelbuettel</a> originated on his <a href="http://dirk.eddelbuettel.com/blog/">Thinking inside the box</a> blog. Please report excessive re-aggregation in third-party for-profit settings.
</p><p>