View source: R/get_trip_speed.R
get_trip_speed | R Documentation |
Returns the speed of each specified trip_id
, based on the geometry created
from either the shapes
or the stop_times
file (or both).
get_trip_speed(
gtfs,
trip_id = NULL,
file = "shapes",
unit = "km/h",
sort_sequence = FALSE
)
gtfs |
A GTFS object, as created by |
trip_id |
A character vector including the |
file |
The file from which geometries should be generated, either
|
unit |
A string representing the unit in which the speeds are desired.
Either |
sort_sequence |
Ultimately passed to |
A data.table
containing the duration of each specified trip and the
file from which geometries were generated.
Please check get_trip_geometry()
documentation to understand how geometry
generation differs depending on the chosen file.
get_trip_geometry()
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)
trip_speed <- get_trip_speed(gtfs)
head(trip_speed)
trip_ids <- c("CPTM L07-0", "2002-10-0")
trip_speed <- get_trip_speed(gtfs, trip_ids)
trip_speed
trip_speed <- get_trip_speed(
gtfs,
trip_ids,
file = c("shapes", "stop_times")
)
trip_speed
trip_speed <- get_trip_speed(gtfs, trip_ids, unit = "m/s")
trip_speed
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.