ipeaGIT / gtfs2gps

Convert GTFS data into a data.table with GPS-like records in R
https://ipeagit.github.io/gtfs2gps/
Other
69 stars 10 forks source link

example of adjust_speed function not working #241

Closed Joaobazzo closed 2 years ago

Joaobazzo commented 2 years ago
> library(dplyr)
> poa <- read_gtfs(system.file("extdata/poa.zip", package="gtfs2gps")) %>%
+     filter_week_days() %>%
+     filter_single_trip()
> 
> poa_gps <- gtfs2gps(poa)
Converting shapes to sf objects
Processing the data
Trip '176-1@1#602' has less than two stop_ids. Ignoring it.
Shape '176-1' has no departure_time. Ignoring it.
Trip 'A141-1@1#30' has less than two stop_ids. Ignoring it.
Shape 'A141-1' has no departure_time. Ignoring it.
Trip 'R10-2@1#645' has less than two stop_ids. Ignoring it.
Shape 'R10-2' has no departure_time. Ignoring it.
Trip 'T2-1@1#520' has less than two stop_ids. Ignoring it.
Shape 'T2-1' has no departure_time. Ignoring it.
0 out of 4 shapes (0%) were properly processed.
0 out of 4 trips (0%) were properly processed.
Warning messages:
1: In eval(jsub, SDenv, parent.frame()) : NAs introduced by coercion
2: In eval(jsub, SDenv, parent.frame()) : NAs introduced by coercion
> poa_gps_new <- adjust_speed(poa_gps)
Error in `:=`(speed, units::drop_units(units::set_units(speed, "m/s"))) : 
  Check that is.data.table(DT) == TRUE. Otherwise, := and `:=`(...) are defined for use in j, once only and in particular ways. See help(":=").
Joaobazzo commented 2 years ago

It is now working. Perhaps I was using an old version of the package.