Description Usage Arguments Value Examples
View source: R/check_valid_date.R
Check date for validity
1 | check_valid_date(.year = NULL, .month = NULL, .day = NULL)
|
.year |
Integer value. |
.month |
Integer value. |
.day |
Integer value. |
Returns NULL if date is ok, else a string with the error message.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # errors
check_valid_date(.year = NA)
date.future <- Sys.Date() + 1L
check_valid_date(.year = lubridate::year(date.future),
.month = lubridate::month(date.future),
.day = lubridate::day(date.future))
check_valid_date(.year = lubridate::year(date.future) + 1L)
check_valid_date(.year = lubridate::year(date.future),
.month = lubridate::month(date.future) + 1L)
check_valid_date(.year = 2016, .month = NA, .day = 10)
check_valid_date(.year = 2018, .month = 13)
check_valid_date(.year = 2018, .month = 12, .day = 32)
# ok
check_valid_date(.year = 2019, .month = 1, .day = 10)
check_valid_date(.year = 2019, .month = 10, .day = NA)
check_valid_date(.year = 2019, .month = NA, .day = NA)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.