Hi,
I couldn't test it (no api key here) but I think this might work:
library(ggmap)
#Generate random locations (as strings)
randomLoc = function(n = 1){
paste0(runif(n,29.00,34.00), #LAT
"+",
runif(5,69.00,72.00)) #LONG
}
#See disctance between locations
mapdist(randomLoc(5), randomLoc(5), mode = "driving",key="A")
The thing is that the locations are now in string format, as you did with the single example. In the other case, you did not merge the LAT and LONG and thus that's what I think produced the error.
Let me know if it works!
PJ