A brand-new release of anytime is now on CRAN following the three earlier releases since mid-September. 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.
With release 0.0.4, we add two nice new features. First, NA
, NaN
and Inf
are now simply skipped (similar to what the corresponding Base R functions do). Second, we now also accept large numeric values so that, _e.g., anytime(as.numeric(Sys.time())
also works, effectively adding another input type. We also have squashed an issue reported by the 'undefined behaviour' sanitizer, and the widened the test for when we try to deploy the gettz package get missing timezone information.
A quick example of the new features:
anydate(c(NA, NaN, Inf, as.numeric(as.POSIXct("2016-09-01 10:11:12"))))
[1] NA NA NA "2016-09-01"
The NEWS
file summarises the release:
Changes in anytime version 0.0.4 (2016-10-20)
Before converting via
lexical_cast
, assign to atomic type via template logic to avoid an UBSAN issue (PR #15 closing issue #14)More robust initialization and timezone information gathering.
More robust processing of non-finite input also coping with non-finite values such as
NA
,NaN
andInf
which all returnNA
Allow numeric
POSIXt
representation on input, also creating properPOSIXct
(or, if requested,Date
)
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.