I'm trying to calculate the time on foot by two coordinates with OpenStreetMap.
I'm using this dataset: https://github.com/JayScribes/Geocode-Distance/blob/main/NYC%20Bike%20Share%20Data.csv
And this is my code:
library(readr)
NYC_Bike_Share_Data <- read_csv("NYC Bike Share Data.csv")
View(NYC_Bike_Share_Data)
library(osrm)
osrm_conn <- osrm::osrmTable(profile = "foot-walking")
origen<-c(NYC_Bike_Share_Data$ss_lat,NYC_Bike_Share_Data$sslong)
destino<-c(NYC_Bike_Share_Data$es_lat,NYC_Bike_Share_Data$es_long)
duracion <- osrmTable(osrm_conn, loc = c(origen, destino))$durations[1]
Output:
Error: "loc" should be a data.frame or a matrix of coordinates, an sfc POINT object or an sf POINT object.