Throws an error if x isn't proper, based on the type.

check_type(x, type)

Arguments

x

Focal input.

type

Type of input that x should be. Presently available are "character" (standard) and "integer" (conformable to an integer if not explicitly classed as such)/

Value

NULL if x is proper, throwing an error otherwise.

Examples

 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