This function ensures that the input vector values match valid values in a source shapefile.

qm_validate(ref, key, value)

Arguments

ref

An sf object that serves as a master list of features

key

Name of geographic id variable in the ref object to match input values to

value

A vector of input values created with qm_define

Value

A logical scalar that is TRUE is all input values match values in the key variable.

See also

qm_define

Examples

# load and format reference data
stl <- stLouis
stl <- dplyr::mutate(stl, TRACTCE = as.numeric(TRACTCE))

# create clusters
clusterValid <- qm_define(118600, 119101, 119300)
clusterError <- qm_define(118600, 119101, 800000)

# validate clusters
qm_validate(ref = stl, key = TRACTCE, value = clusterValid)
#> [1] TRUE

qm_validate(ref = stl, key = TRACTCE, value = clusterError)
#> [1] FALSE