If the variable matches a single geographic shapefile hosted by crunch,
addGeoMetadata
will make the appropriate CrunchGeography
to add to a
variable's geo()
metadata. It matches based on how well the contents of the
variable match the feature properties that are in each shapefile.
addGeoMetadata(variable, ...)
a Crunch variable to use for matching. This must be either a text or a categorical variable.
arguments passed on to matchCatToFeat()
for example a set of
available geographic features as all_features
if you want to limit the
number of features to be considered.
a CrunchGeography
object that can be assigned into geo(variable)
If more than one property of the same geographic shapefile has the same highest matching score, the first one will be used.
If more than one geographic shapefile has the same highest matching score, an
error will be printed listing the geographic shapefiles that matched.
Information from this error can be used to setup an appropriate
CrunchGeography
by hand to connect a variable with the metadata needed.
if (FALSE) {
geo(ds$state) <- addGeoMetadata(ds$state)
}