This function ensures that the input vector values match valid values in a source shapefile.
qm_validate(ref, key, value)
An sf
object that serves as a master list of features
Name of geographic id variable in the ref
object to match input values to
A vector of input values created with qm_define
A logical scalar that is TRUE
is all input values match values in the key variable.
qm_define
# 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