Throws an error if x
isn't proper, based on the
type
.
check_type(x, type)
x | Focal input. |
---|---|
type | Type of input that |
NULL
if x
is proper, throwing an error otherwise.
names <- "sam" check_type(x = names, type = "character") names <- 2019 #check_type(x = names, type = "character") # throws error years <- 2019 check_type(x = years, type = "integer") years <- "sam" #check_type(x = years, type = "integer") # throws error