Site icon R-bloggers

anytime 0.1.0: New features, some fixes

[This article was first published on Thinking inside the box , and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

A new release of anytime is now on CRAN following the four releases in September and October.

anytime aims to convert anything in integer, numeric, character, factor, ordered, … format to POSIXct (or Date) objects — and does so without requiring a format string. See the anytime page for a few examples.

Release 0.1.0 adds several new features. New functions utctime() and utcdate() parse to coordinated universal time (UTC). Several new formats were added. Digit-only formats like ‘YYYYMMDD’ with or without ‘HHMMSS’ (or even with fractional secodns ‘HHMMSS.ffffff’) are supported more thoroughly. Some examples:

R> library(anytime)
R> anytime("20161107 202122")   ## all digits
[1] "2016-11-07 20:21:22 CST"
R> utctime("2016Nov07 202122")  ## UTC parse example
[1] "2016-11-07 14:21:22 CST"
R> 

The NEWS file summarises the release:

Changes in anytime version 0.1.0 (2016-11-06)

  • New functions utctime() and utcdate() were added to parse input as coordinated universal time; the functionality is also available in anytime() and anydate() via a new argument asUTC (PR #22)

  • New (date)time format for RFC822-alike dates, and expanded existing datetime formats to all support fractional seconds (PR #21)

  • Extended functionality to support not only ‘YYYYMMDD’ (without a separator, and not covered by Boost) but also with ‘HHMM’, ‘HHMMSS’ and ‘HHMMSS.ffffff’ (PR #30 fixing issue #29)

  • Extended functionality to support ‘HHMMSS[.ffffff]’ following other date formats.

  • Documentation and tests have been expanded; typos corrected

  • New (unexported) helper functions setTZ, testOutput, setDebug

  • The testFormat (and testOutput) functions cannot be called under RStudio (PR #27 fixing issue #25).

  • More robust support for non-finite values such as NA, NaN or Inf (Fixing issue #16)

Courtesy of CRANberries, there is a comparison to the previous release. More information is on the anytime page.

For questions or comments use the issue tracker off the GitHub repo.

This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.

To leave a comment for the author, please follow the link and comment on their blog: Thinking inside the box .

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.