Try to parse input as a date

parse_date(x)

Arguments

x

a integer or character vector, see examples

Examples

parse_date(2006)
#> [1] "2006-01-01"
parse_date("2006")
#> [1] "2006-01-01"
parse_date("2006-06")
#> [1] "2006-06-01"
parse_date("2006-06-01")
#> [1] "2006-06-01"
parse_date(as.Date("2006-06-01"))
#> [1] "2006-06-01"