View source: R/convert_seconds_to_time.R
| convert_seconds_to_time | R Documentation |
Converts times in seconds after midnight to strings in the "HH:MM:SS"
format, as used in stop_times and frequencies. It is the counterpart of
convert_time_to_seconds(), useful to write back times calculated from the
_secs columns.
convert_seconds_to_time(seconds)
seconds |
A numeric vector with whole numbers of seconds after
midnight, between 0 and 35999999 ( |
A character vector with the same length as seconds. NAs are
converted to "", as blank times in GTFS. Times past midnight keep
counting the hours (e.g. "25:30:00"). Names are dropped.
convert_time_to_seconds()
convert_seconds_to_time(c(0, 3600, 91800, NA))
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)
gtfs <- convert_time_to_seconds(gtfs, file = "stop_times")
# delay every departure by 5 minutes
delayed_departure <- convert_seconds_to_time(
gtfs$stop_times$departure_time_secs + 300
)
head(delayed_departure)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.