R/geo_place.R
geo_place.Rd
This function takes the name of a well-known NYC place and returns the
Geoclient response as a tibble. The place name, and one of either borough
or Zip code are required. The place 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.
geo_place_data(.data, place, borough = NULL, zip = NULL, id = NULL, key = NULL, rate_limit = TRUE) geo_place(place, borough = NULL, zip = NULL, id = NULL, key = NULL, rate_limit = TRUE)
.data | Dataframe containing columns to be used for other arguments. |
---|---|
place | Either a vector of BBLs (numeric or character is accepted), or a bare column name of the bbl field if a dataframe is provided. |
borough | The name of the borough of the place, 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 place, as either a vector (numeric or character is accepted) or a bare column name of the borough field if a dataframe is provided. Five- and seven-digit Zip codes are accepted. 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 |
key | The API app key provided to you from the NYC Developer Portal
formated in quotes. Defaults to |
rate_limit | Whether you would like to limit the rate of API requests in
adherence to Geoclient's Service Usage Guidelines. See |
For more details see the Geoclient Documentation's guide to making place requests, interpreting the Geosupport return codes, the data returned by geo_place, and a complete data dictionary for all possible data elements returned by any geoclient function.
# NOT RUN { geoclient_api_keys("1a2b3c4", "9d8f7b6wh4jfgud67s89jfyw68vj38fh") geoclient_place(place = "empire state building", borough = "mn") library(tibble) library(dplyr) df <- tribble( ~place, ~boro, ~zip, "NYU", NA_character_, "10012", "CITY HALL", "MN", NA_character_, "Pospect Park", "Brooklyn", NA_character_ ) geoclient_place(df, place, boro, zip) df %>% mutate( bbl = geoclient_place(place = place, borough = boro, zip = zip)[["bbl"]] ) # }