Over the last few years, I have added R to the book to support the demand for data analytics.
Here is a case that can be used as a capstone to the R material.
The core R code follows. This is not the answer, but just code for checking that the data are available and examples of how to use the distance functions.
library(readr)
library(DBI)
library(geosphere)
library(ggmap)
# get the employee data
t <- read_delim(url,delim=',')
# access the zip code databases
conn <- dbConnect(RMySQL::MySQL(), "
wallaby.terry.uga.edu", dbname="zipcode", user="student", password="student")
# Query the database and create file z for use with R
loc1 <- dbGetQuery(conn,"SELECT zipLat, zipLon from zip where zip = 30606;")
loc2 <- dbGetQuery(conn,"SELECT zipLat, zipLon from zip where zip = 08889;")
# compute the great circle distance in miles
distGeo(c(loc1$zipLat,loc1$zipLon),c(loc2$zipLat,loc2$zipLon))*0.000621371
# compute the road distance in miles
mapdist("Athens, GA", "Whitehouse Station, NJ", mode = c("driving"), output = c("simple", "all"))[[5]]