View source: R/get_trip_segment_duration.R
get_trip_segment_duration | R Documentation |
Returns the duration of segments between stops of each specified trip_id
.
get_trip_segment_duration(
gtfs,
trip_id = NULL,
unit = "min",
sort_sequence = FALSE
)
gtfs |
A GTFS object, as created by |
trip_id |
A string vector including the |
unit |
A string representing the time unit in which the duration is
desired. One of |
sort_sequence |
A logical specifying whether to sort timetables by
|
A data.table
containing the segments' duration of each specified
trip.
A trip segment is defined as the path between two subsequent stops in the
same trip. The duration of a segment is defined as the time difference
between its arrival time and its departure time, as specified in the
stop_times
file.
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)
trip_segment_dur <- get_trip_segment_duration(gtfs)
head(trip_segment_dur)
# use the trip_id argument to control which trips are analyzed
trip_segment_dur <- get_trip_segment_duration(gtfs, trip_id = "CPTM L07-0")
trip_segment_dur
# use the unit argument to control in which unit the durations are calculated
trip_segment_dur <- get_trip_segment_duration(gtfs, "CPTM L07-0", unit = "s")
trip_segment_dur
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.