cxy_geocode: Batch Geocode Parsed Addresses

Description Usage Arguments Details Value Examples

View source: R/batch.R

Description

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 10,000 and more efficiently than sending 10,000 per request. It also supports multiple outputs, including SF class objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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"
)

Arguments

.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

benchmark

Optional Census Benchmark to geocode against. See Details.

vintage

Optional Census Vintage to geocode against. See Details.

timeout

Numeric, in minutes, how long until request times out

parallel

Integer, number of cores greater than one if parallel requests are desired. See Details.

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.

Details

Parallel requests are not currently supported on Windows. You may not specify more cores than the system reports are available If you do, the maximum number of available cores will be used.

To obtain current valid benchmarks, use the cxy_benchmarks() function

If you want to append census geographies, you must specify a valid vintage for your benchmark. You may use the cxy_vintages() function to obtain valid Vintages. See vignette('censusxy') for a full walkthrough.

Value

A data.frame or sf object containing geocoded results

Examples

1
2
3
4
5
6
# 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')

censusxy documentation built on Feb. 18, 2021, 9:06 a.m.