# sample dataframe
sample <- data.frame(start_lat = c(1.3746617, 1.3567797, 1.3361976, 500),
start_lon = c(103.8366159, 103.9347695, 103.6957732, 501),
end_lat = c(1.429443081, 1.380298287, 1.337586882, 601),
end_lon = c(103.835005, 103.7452918, 103.6973215, 600),
add_info = c("a", "b", "c", "d"))
# no error, wide format
if (FALSE) get_travel(token, sample[1:3, ],
"start_lat", "start_lon", "end_lat", "end_lon",
routes = c("cycle", "walk"))
if (FALSE) get_travel(token, sample[1:3, ],
"start_lat", "start_lon", "end_lat", "end_lon",
routes = c("drive", "pt"), pt_mode = c("bus", "transit"))
# no error, long format
if (FALSE) get_travel(token, sample[1:3, ],
"start_lat", "start_lon", "end_lat", "end_lon",
routes = c("walk", "pt"), pt_mode = c("bus", "transit"),
as_wide = FALSE)
# no error, sf dataframe
if (FALSE) get_travel(token, sample[1:3, ],
"start_lat", "start_lon", "end_lat", "end_lon",
routes = c("drive", "pt"), pt_mode = c("bus", "transit"),
as_wide = FALSE, route_geom = TRUE)
# with error
# warning message will show start/end/route/pt_mode for which an error occurred
if (FALSE) get_travel(token, sample,
"start_lat", "start_lon", "end_lat", "end_lon",
routes = c("cycle", "walk"))
Run the code above in your browser using DataLab