README.md

strdate

strdate converts a text string into a date:

> strdate("now")
[1] "2016-06-05 14:33:54 CDT"
> strdate("3 minutes from now")
[1] "2016-06-05 14:36:54 CDT"
> strdate("1 day from now")
[1] "2016-06-06 14:33:54 CDT"
> strdate("3 minutes ago")
[1] "2016-06-05 14:30:54 CDT"
> strdate("1 day and 3 minutes from now")
[1] "2016-06-06 14:36:54 CDT"

date_range can enumerate days between two dates:

> date_range("5 days ago", "now")
[1] "2016-09-18" "2016-09-19" "2016-09-20" "2016-09-21" "2016-09-22"
[6] "2016-09-23"

Acknowledgements

Code was taken from Robert Krzyzanowski's testthatsomemore package, with permission.

Install

Strdate is not yet available via CRAN. Instead, it needs to be installed via devtools:

if (!require("devtools")) { install.packages("devtools"); library(devtools) }
install_github("peterhurford/strdate")


peterhurford/strdate documentation built on May 25, 2019, 1:51 a.m.