Takes a date string in YYYY-MM-DD format and returns a date object, or a null replacement value if input is null.
Usage
cast_date_string(x, null_replacement_value)
Arguments
- x
Date string in YYYY-MM-DD format
- null_replacement_value
Value to return if input is null
Value
A date object representing the input string
Examples
cast_date_string("2022-03-02", "No date")
#> Error in ymd(x, quiet = TRUE): could not find function "ymd"
cast_date_string(NULL, "No date")
#> [1] "No date"