Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
anytime just arrived on CRAN as a very first release 0.0.1.
So why (yet another) package dealing with dates and times? R excels at computing with dates, and times. By using typed representation we not only get all that functionality but also of the added safety stemming from proper representation.
But there is a small nuisance cost: How often have we each told as.POSIXct()
that the origin is epoch ‘1970-01-01’? Do we have to say it a million more times? Similarly, when parsing dates that are in some recogniseable form of the YYYYMMDD format, do we really have to manually convert from integer
or numeric
or factor
or ordered
to character first? Having one of several common separators and/or date / time month forms (YYYY-MM-DD, YYYY/MM/DD, YYYYMMDD, YYYY-mon-DD and so on, with or without times, with or without textual months and so on), do we really need a format string?
anytime()
aims to help as a small general purpose converter returning a proper POSIXct
(or Date
) object nomatter the input (provided it was somewhat parseable), relying on Boost date_time for the (efficient, performant) conversion.
See some examples on the anytime page or the GitHub README.md, or in the screenshot below. And then just give it try!
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.
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.