impute_pdates | R Documentation |
Imputes missing date elements for start or end dates. Partial dates should be
in the format "UNKN-UN-UN"
or some combination of those characters and
numbers (ie "2017-UN-UN"
). Dates with no information or dates with a
missing year will be converted to NA
. For start dates, missing days are
assumed to be the first of the month while missing months are assumed to be
January. For end dates, missing days are assumed to be the last day of the
month and missing months are assumed to be December.
impute_pdates(dates, ptype, input_sep = "-")
dates |
a character vector of partial dates (which could also contain full dates) in the format YYYY-MM-DD |
ptype |
a string of either |
input_sep |
the character that separates date components in |
a date vector of imputed dates in the format YYYY-MM-DD
reshape_adates()
, reshape_pdates()
, trim_dates()
,
vignette("Dates")
dates <- c(
"UNKN-UN-UN",
"2017-UN-UN",
"2017-02-UN",
"2017-UN-05",
"2017-09-03",
"UNKN-07-14",
NA
)
impute_pdates(dates, ptype = "start")
impute_pdates(dates, ptype = "end")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.