Learn R Programming

rpubmed (version 0.1)

geocode_address: Function to get coordinates from a supplied address If no match is found, it recursively calls itself on the address minus the first line of the address

Description

Function to get coordinates from a supplied address If no match is found, it recursively calls itself on the address minus the first line of the address

Usage

geocode_address(address, depth = 3, sleeper = 0)

Arguments

address
string
depth
depth integer recursion depth for attempting to get coordinates. If the full address fails to get a hit, the function is called again with the first line of the address removed. The process is repeated depth times before returning NAs
sleeper
numeric Number of seconds to pause after doing the geocoding

Value

vector of address, lat, long

Examples

Run this code
## Not run: 
# x <- "Rothamsted Research, Harpenden, Herts AL5 2JQ, UK."
# geocode_address(x)
# ## End(Not run)

Run the code above in your browser using DataLab