geoclient_address: Retrieve Geoclient Response for Addresses as a Dataframe

Description Usage Arguments Details Examples

View source: R/geoclient_address.R

Description

This function takes components of addresses and returns the Geoclient response as a tibble. The house number, street name, and one of either borough or Zip code are required. The address components can be provided either in separate vectors as named arguments or with a dataframe and column names containing each component. The Geoclient API's app ID and key can either be provided directly as arguments, or you can first use geoclient_api_keys() to add them to your .Renviron file so they can be called securely without being stored in your code.

Usage

1
2
geoclient_address(df = NULL, number, street, borough = NULL, zip = NULL,
  id = NULL, key = NULL, rate_limit = TRUE, cap_daily_requests = TRUE)

Arguments

df

Dataframe that contains a column of BBLs. Defaults to NULL and bbl is taken as a vector.

number

The house number of the address, as either a vector of numbers (numeric or character is accepted), or a bare column name of the number field if a dataframe is provided.

street

The street name of the address, as either a vector of names, or a bare column name of the number field if a dataframe is provided.

borough

The name of the borough of the address, as either a vector or a bare column name of the borough field if a dataframe is provided. The borough is only required if Zip code is not provided.

zip

The Zip code of the address, as either a vector (numeric or character is accepted) or a bare column name of the borough field if a dataframe is provided. The Zip code is only required if borough is not provided.

id

The API app ID provided to you from the NYC Developer Portal formated in quotes. Defaults to NULL and your key is accessed from your .Renviron.

key

The API app key provided to you from the NYC Developer Portal formated in quotes. Defaults to NULL and your key is accessed from your .Renviron.

rate_limit

Whether you would like to limit the rate of API requests in adherence to Geoclient's Service Usage Guidelines. See ?geoclient for more information.

cap_daily_requests

Whether you would like to cap the daily number of API requests in adherence to Geoclient's Service Usage Guidelines. See ?geoclient for more information.

Details

For more details see the Geoclient Documentation's guide to making address requests, interpreting the Geosupport return codes, the data returned by geoclient_address, and a complete data dictionary for all possible data elements returned by any geoclient function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 

geoclient_api_keys("1a2b3c4", "9d8f7b6wh4jfgud67s89jfyw68vj38fh")

geoclient_address(
  number = "139",
  street = "MacDougal St",
  borough = "manhattan",
  zip = "11231"
)

library(tibble)
library(dplyr)

df <- tribble(
  ~num,  ~st,                ~boro,         ~zip,
  "139", "MacDougal St",     "manhattan",   "11231",
  "295", "Lafayette street", NA_character_, "10012-2722",
  "40",  "WASHINGTON SQ S",  "MN",          NA_character_
)

geoclient_address(df, num, st, boro, zip)

df %>%
  mutate(
    bbl = geoclient_address(number = num, street = st, borough = boro, zip = zip)[["bbl"]]
  )

## End(Not run)

austensen/geoclient documentation built on Jan. 22, 2018, 9:12 p.m.