geocode | R Documentation |
Takes a dataframe containing addresses as an input and returns
the results from a specified geocoding service in a dataframe format using the
geo function. See example usage in vignette("tidygeocoder")
.
This function passes all additional parameters (...
) to the
geo function, so you can refer to its documentation for more details
on possible arguments.
Note that the arguments used for specifying address columns (address
,
street
, city
, county
, state
, postalcode
, and country
) accept either
quoted or unquoted column names (ie. "address_col"
and address_col
are
both acceptable).
geocode( .tbl, address = NULL, street = NULL, city = NULL, county = NULL, state = NULL, postalcode = NULL, country = NULL, lat = "lat", long = "long", return_input = TRUE, limit = 1, return_addresses = NULL, unique_only = FALSE, ... )
.tbl |
dataframe containing addresses |
address |
single line street address column name. Do not combine with
address component arguments ( |
street |
street address column name |
city |
city column name |
county |
county column name |
state |
state column name |
postalcode |
postal code column name (zip code if in the United States) |
country |
country column name |
lat |
latitude column name. Can be quoted or unquoted (ie. |
long |
longitude column name. Can be quoted or unquoted (ie. |
return_input |
if TRUE then the input dataset will be combined with the geocoder query results and returned. If FALSE only the geocoder results will be returned. |
limit |
maximum number of results to return per input address. For many geocoding services the maximum value of the limit parameter is 100. Pass |
return_addresses |
if TRUE return input addresses. Defaults to TRUE if |
unique_only |
if TRUE then only unique results will be returned and return_input will be set to FALSE. |
... |
arguments passed to the geo function |
tibble (dataframe)
geo
library(dplyr, warn.conflicts = FALSE) sample_addresses %>% slice(1:2) %>% geocode(addr, method = "arcgis") louisville %>% head(2) %>% geocode( street = street, city = city, state = state, postalcode = zip, method = "census", full_results = TRUE ) sample_addresses %>% slice(8:9) %>% geocode(addr, method = "osm", limit = 2, return_input = FALSE, full_results = TRUE ) sample_addresses %>% slice(4:5) %>% geocode(addr, method = "arcgis", lat = latitude, long = longitude, full_results = TRUE )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.