TO BE added to vignettes/
upon completion.
It would be good to add to the package a vignette that explains common processes in data reading and the reational behind it.
For instance, the vignette 011_Tidy_State_data.Rmd
describes why using parsedate::parse_date
over lubridate::ymd_hms
is convenient in our case. It might be good to keep a manual here that details why these choices are made, and what the potential shortcomings are.
For now, I'll note here what this vignette should be populated with.
lubridate::ymd
vs parsedate::parse_date
*Copied from 011_Tidy_State_data.Rmd
.
There are a few options for parsing the dates. A common option is to use lubridate::ymd_hms (or similar) considering we are potentially merging different datasets, it might be good to have a function that is more flexible. If, for instance, some entries are missing the seconds, or even have a different order in y/m/d, those rows might be skipped completely. The function parsedate::parse_date (note, this is different from readr::parse_date) is extremely flexible with regard to the date format. Which is why we prefer it.
library(readr) library(parsedate) mix_dates <- c("2015-12-25 19:06", "01/31/2017 07:01 PM", "01/31/2017 07:01", "01/31/2017 07:01:45") parsedate::parse_date(mix_dates) readr::parse_date(mix_dates)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.