Geocoding via Google maps

Geocoding is converting an address to a to spatial coordinates. Google has provided a geocoding API to do this for you, however they limit usage to 2,500 addresses a day. I can use this to be able to map survey participants by their univeristy affiliations.

library(ggmap)
library(dplyr)

df<-read.csv("locations.csv")
##summarize data by affiliation
affiliation.df<-df%>%
  group_by(Affiliation_clean)%>%
  summarize(n=length(Name))

length(unique(df$Affiliation_clean))
## [1] 492

OK those affiliations definitely need some cleaning but will get back to that later.
Now via the R console we can do a google search for addresses.

geocode("Ian's pizza, WI", output = "latlon")
##         lon      lat
## 1 -88.78787 43.78444

This code returns the lat and long for your search.