我正在尝试使用ggmap,但我无法弄清楚如何为我列表中的所有zipcodes运行它...
library(readxl)
library(ggplot2)
library(ggmap)
zip_code_data <-
read_excel("D:/Desktop/Institutional Research/Zip code data for study.xlsx")
sapply(zip_code_data2$Zip2, function(x) mapdist('19426', x, mode = 'driving'))
#dataset below, shortened due to character limit, dataset is 1460 entries
zip_code_data2<-data.frame(City = c("Douglassville", "Bartlett", "Harleysville", "Westport", "Clayton"),
Abrv = c("PA", "NJ", "CT", "PA", "NJ"),
State = c("Pennsylvania", "New Jersey", "Connecticut", "Pennsylvania", "New Jersey"),
Zip = c("19380-3306", "08096-3533", "06437-1936", "19540-1100", "08094-4114"),
Zip2 = c("19380", "08096", "06437", "19540", "08094"))