I am trying to use the package ggmap
to caculate the distance for a target address with a list of addresse. My data in a csv looks like below:
Order ID Address
1652049 435 E 70TH ST,10021
1652123 1365 YORK AVE,10021
1652053 530 E 72ND ST,10021
so I try to get the distance from my input address to all those address for example: 400 Hudson St,10013, and I have following code in R:
library(ggmap)
mydata<-read.csv("address.csv")
mydata$Address<-as.character(mydata$Address)
mydata$Distance<-NA
a<-c("289 Hudson St,10013")
mydata$Distance<-mapdist(mydata$Address,a)$miles
However the code gives me a error message as below:
Error in `$<-.data.frame`(`*tmp*`, "Distance", value = c(8.2403854, 8.2403854, :
replacement has 53 rows, data has 31