# \dontshow{
old_dt_threads <- data.table::setDTthreads(1)
# }
library(dplyr)
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)
trip <- "CPTM L07-0"
# converts all trips listed in the frequencies table
converted_gtfs <- frequencies_to_stop_times(gtfs)
# converts only the specified trip_id
converted_gtfs <- frequencies_to_stop_times(gtfs, trip)
# how the specified trip_id was described in the frequencies table
gtfs$frequencies |>
filter(trip_id == trip) |>
head()
# the first row of each equivalent stop_times entry in the converted gtfs
converted_gtfs$stop_times |>
filter(grepl(trip, trip_id)) |>
distinct(trip_id, .keep_all = TRUE)
data.table::setDTthreads(old_dt_threads)
Run the code above in your browser using DataLab