Learn R Programming

ggmap (version 2.6.1)

mutate_geocode: Geocode a dataset

Description

mutate_geocode geocodes a data frame and appends the new information to the data frame provided.

Usage

mutate_geocode(data, location, ...)

Arguments

data

a data frame

location

a character string specifying a location of interest (e.g. "Baylor University")

...

arguments to pass to geocode

Value

data with geocoded information appended as columns

See Also

geocode

Examples

Run this code
# NOT RUN {

df <- data.frame(
  address = c("1600 Pennsylvania Avenue, Washington DC", "", "houston texas"),
  stringsAsFactors = FALSE
)

# }
# NOT RUN {
 # Server response can be slow; this cuts down check time.
mutate_geocode(df, address)


library(dplyr)
df %>% mutate_geocode(address)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab