Learn R Programming

crunch (version 1.30.4)

CrunchGeography-class: Geography properties for crunch variables

Description

Crunch stores geographic data as variable metadata. There are a number of functions that help access and change this metadata.

Usage

CrunchGeography(..., data = NULL)

geo(x)

geo(x) <- value

# S4 method for CrunchVariable geo(x)

# S4 method for CrunchVariable,CrunchGeography geo(x) <- value

# S4 method for CrunchVariable,`NULL` geo(x) <- value

availableGeodata(x = getAPIRoot())

Value

geographic information of class CrunchGeography (NULL if there is none)

Arguments

...

for CrunchGeography, named arguments from which to construct a CrunchGeography: geodatum, feature_key, and match_field

data

for CrunchGeography, list of named arguments from which to construct a CrunchGeography: geodatum, feature_key, and match_field

x

a crunch variable

value

value of the geography property to set

Details

geo retrieves the geographic information associate with a variable. If there is geographic information it returns an object of class CrunchGeography otherwise it returns NULL.

CrunchGeography objects store geography metadata from a variable. There are three slots:

  • geodatum an object of class CrunchGeodata which stores references to the Crunch-hosted (geo|topo)json to use

  • feature_key a character string representing the feature inside of the (geo|topo)json which is used to match match_field (e.g. properties.name)

  • match_field a character string representing the variable metadata information which is used to match feature_key to (e.g. name)

Examples

Run this code
if (FALSE) {
geo(ds$location)

geo(ds$location)$feature_key <- "properties.name"
geo(ds$location)$match_field <- "name"
}

Run the code above in your browser using DataLab