Checks a set of variables can be coerced to a date and coerces them
Source:R/params_check_date.R
check_date.Rd
Checks a set of variables can be coerced to a date and coerces them
Usage
check_date(
...,
.message = "`{param}` is not a date: ({err}).",
.env = rlang::caller_env()
)
Arguments
- ...
Arguments passed on to
base::as.Date
x
an object to be converted.
- .message
a glue spec containing
{param}
as the name of the parameter and{err}
the cause fo the error- .env
the environment to check (defaults to calling environment)
Examples
a = c(1:4L)
b = c("1",NA,"3.3")
f = NULL
g = NA
check_numeric(a,b,f,g)
c = c("dfsfs")
try(check_numeric(c,d, mean))
#> Warning: 1) 'd' is not defined in this context
#> 2) 'mean' is not defined in this context
#> Error in .check_framework(..., predicate = predicate, convert = convert, :
#> 1) `c` is non-numeric (non numeric format).