# \dontshow{
old_dt_threads <- data.table::setDTthreads(1)
on.exit(data.table::setDTthreads(old_dt_threads), add = TRUE)
# }
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
head(gtfs$frequencies[trip_id == trip])
# the first row of each equivalent stop_times entry in the converted gtfs
equivalent_stop_times <- converted_gtfs$stop_times[grepl(trip, trip_id)]
equivalent_stop_times[equivalent_stop_times[, .I[1], by = trip_id]$V1]
Run the code above in your browser using DataLab