ropensci / stplanr

Sustainable transport planning with R
https://docs.ropensci.org/stplanr
Other
420 stars 66 forks source link

Route function requires the pbapply package #460

Closed Robinlovelace closed 3 years ago

Robinlovelace commented 3 years ago

Reproducible example:

> remove.packages("pbapply")
Removing package from ‘/usr/local/lib/R/site-library’

Restarting R session...

> routes = route(l = desire_lines_top, route_fun = cyclestreets::journey, plan = "balanced")
Error in route(l = desire_lines_top, route_fun = cyclestreets::journey,  : 
  could not find function "route"
> 
> library(tidyverse)
── Attaching packages ────────────────────────────────────────────────────────────────── tidyverse 1.3.0 ──
✔ ggplot2 3.3.3     ✔ purrr   0.3.4
✔ tibble  3.1.0     ✔ dplyr   1.0.5
✔ tidyr   1.1.3     ✔ stringr 1.4.0
✔ readr   1.4.0     ✔ forcats 0.5.1
── Conflicts ───────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
> library(stplanr)
> library(pct)
> library(tmap)
> library(cyclestreets)
> tmap_mode("view")
tmap mode set to interactive viewing
> #> tmap mode set to interactive viewing
> nchar(Sys.getenv("CYCLESTREETS")) # check you have API key for routing
[1] 16
> #> [1] 16
> desire_lines = pct::get_pct_lines(region = "devon")
> desire_lines_top = desire_lines %>% 
+     top_n(n = 20, wt = all) %>% 
+     select(all:bicycle)
> 
> routes = route(l = desire_lines_top, route_fun = cyclestreets::journey, plan = "balanced")
Most common output is simpleError
These routes failed: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
The first of which was:
<simpleError in ldf[i, 1:2]: invalid subscript type 'list'>
Returning list

This caused issues in the geocompr book https://github.com/Robinlovelace/geocompr/issues/607 and the actdev project https://github.com/cyipt/actdev/issues/156 and probably numerous other issues that were not reported.