cxy_geocode | R Documentation |
Provides access to the US Census Bureau batch endpoints for locations and
geographies. The function implements iteration and optional parallelization
in order to geocode datasets larger than the API limit of 1,000 and more
efficiently than sending 10,000 per request. It also supports multiple outputs,
including (optionally, if sf
is installed,) sf
class objects.
cxy_geocode( .data, id = NULL, street, city = NULL, state = NULL, zip = NULL, return = "locations", benchmark = "Public_AR_Current", vintage = NULL, timeout = 30, parallel = 1, class = "dataframe", output = "simple" )
.data |
data.frame containing columns with structured address data |
id |
Optional String - Name of column containing unique ID |
street |
String - Name of column containing street address |
city |
Optional String - Name of column containing city |
state |
Optional String - Name of column containing state |
zip |
Optional String - Name of column containing zip code |
return |
One of 'locations' or 'geographies' denoting returned information from the API. If you would like Census geography data, you must specify a valid vintage for your benchmark. |
benchmark |
Optional Census benchmark to geocode against. To obtain current
valid benchmarks, use the |
vintage |
Optional Census vintage to geocode against. You may use the
|
timeout |
Numeric, in minutes, how long until request times out |
parallel |
Integer, number of cores greater than one if parallel requests are desired. All operating systems now use a SOCK cluster, and the dependencies are not longer suggested packages. Instead, they are installed by default. Note that this value may not represent more cores than the system reports are available. If it is larger, the maximum number of available cores will be used. |
class |
One of 'dataframe' or 'sf' denoting the output class. 'sf' will only return matched addresses. |
output |
One of 'simple' or 'full' denoting the returned columns. Simple returns just coordinates. |
Parallel requests are supported across platforms. If supported (POSIX platforms) the process is forked, otherwise a SOCK cluster is used (Windows). You may not specify more cores than the system reports are available
A data.frame or sf object containing geocoded results
# load data x <- stl_homicides[1:10,] # geocode cxy_geocode(x, street = 'street_address', city = 'city', state = 'state', zip = 'postal_code', return = 'locations', class = 'dataframe', output = 'simple')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.