Skip to contents

Test if x is a Date, coerce if not

Usage

check_date(x)

Arguments

x

vector of putative dates

Value

vector with class Date, or error

Examples

d1 <- check_date("1920-01-01")
d1
#> [1] "1920-01-01"
class(d1)
#> [1] "Date"
# returns an error if x can't be coerced to Date easily
# check_date("may 29th")