Learn R Programming

crunch (version 1.30.4)

addGeoMetadata: Add geodata metadata to a crunch variable

Description

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.

Usage

addGeoMetadata(variable, ...)

Value

a CrunchGeography object that can be assigned into geo(variable)

Arguments

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.

Details

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.

Examples

Run this code
if (FALSE) {
geo(ds$state) <- addGeoMetadata(ds$state)
}

Run the code above in your browser using DataLab