Initial processing of data from source

library(stringr)
main_addresses=read.csv("Addresses.csv")
indian_addresses=subset(main_addresses,main_addresses$countries=="India")
indian_addresses$address<- gsub('[*/,.;#@`~!-]', ' ', indian_addresses$address)
write.csv(indian_addresses,file="Indian Addresses.csv")
## Loading required package: ggplot2
Define a function that will process googles server responses for us.
Find out where to start in the address list (if the script was interrupted before):
## [1] "Found temp file - resuming from index:"
## [1] 708
Start the geocoding process - address by address. geocode() function takes care of query speed limit.
Adding the lat long to main data

Write the data to file

write.csv(data,file="Addresses_geocoded.csv")
addressplot<-na.omit(as.data.frame(cbind(data$lat,data$long)))
colnames(addressplot)<-c("lat","long")

Plot the data on map

mapgilbert <- get_map(location = c(lon = mean(addressplot$long), lat = mean(addressplot$lat)), zoom = 4,maptype = "satellite", scale = 2)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=21.875495,74.538124&zoom=4&size=640x640&scale=2&maptype=satellite&language=en-EN&sensor=false
ggmap(mapgilbert) +
  geom_point(data = addressplot, aes(x = long, y = lat, fill = "red", alpha = 0.8), size = 2, shape = 21) +
  guides(fill=FALSE, alpha=FALSE, size=FALSE)
## Warning: Removed 14 rows containing missing values (geom_point).

View Indian Addresses in a full screen map