date_from_partial | R Documentation |
Derive a date vector from a partial date string
date_from_partial(
x,
format = "ymd",
method = c("min", "max"),
year_replacement = NA_integer_
)
x |
A vector of dates written as characters |
format |
Format order of the date (accepts only combinations of |
method |
Method for reporting partial dates as either the earliest
possible date ( |
year_replacement |
(Default: |
Takes a character as an argument and attempts to create a date object when part of the date string is missing.
A vector of Dates
x <- c("2020-12-17", NA_character_, "", "2020-12-UN", "2020-12-UN",
"2019-Unknown-00", "UNK-UNK-UNK", "1991-02-UN", " ",
"2020January20")
data.frame(
x = x,
min = date_from_partial(x),
max = date_from_partial(x, method = "max"),
year = date_from_partial(x, year_replacement = 1900)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.