# Load data
data("com")
# Time and Distance between 2 points
route <- osrmViaroute(xo = com[1,"lon"], yo = com[1,"lat"],
xd = com[15,"lon"], yd = com[15,"lat"])
# Time travel distance (min)
route[1]
# Travel distance (km)
route[2]
# Mean Speed (km/h)
route[2]/(route[1]/60)
Run the code above in your browser using DataLab