R/data-check.R
variable_allowed_values.Rd
This is intended to be called from data_allowed_values
.
Prints a warning message on a failed check.
variable_allowed_values(x, x_name, allowed_values)
x | vector: variable to check |
---|---|
x_name | character: name of variable to print in warning |
allowed_values | vector: values the variable is allowed to take |
Other functions to check data format: data_check_table
,
data_check
, data_foreign_key
,
data_internal
data(lic) variable_allowed_values(lic$type, "lic-type", c("hunt", "fish", "combo")) x <- c(NA, "hi", 1, lic$type) variable_allowed_values(x, "lic-type", c("hunt", "fish", "combo"))#> Warning: lic-type: Contains values that aren't allowed: NA, hi, 1