knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
devtools::install_github("ytingc/rCTA",build_vignettes = TRUE)
library(rCTA)

This vignette covers how to use function myfavrt to set up a favorite route get real-time information in the rCTA package. It allows users to get a dataframe of estimated arrival time, waiting time, travel time, delay and alert message. It also allows users to collect and save the real-time information for a given period in a data frame through calling the function periodically.

NOTE: Since the CTA system updates data about once per minute, it may generate error message No arrival times if the system has not been updated yet. Also, it may generate an error message No service scheduled when you request at a time out of operation.

Get Real-time Traveling Information

Function myfavrt() allows to set up your favorite routes based on bus, start_id and end_id:

After setting up, this function will provide you a set of real-time information and about your traveling, including:

For example:

Get the information of my favorite route as a dataframe. In this example, we only collect the real-time information once, so we set the arguments interval to 0, and times to 1.

result <- myfavrt(bus = 126, start_id = 36, end_id = 60, interval= 0, times = 1)
knitr::kable(head(result))

Collect and Save the Real-time Information Periodically

This function also allow users to collect and save the real-time information in a dataframe through calling the function periodically.

For example:

Get my favorite route as above, collect the real-time information once per minute, and repeat 5 times.

result <- myfavrt(bus = 126, start_id = 36, end_id = 60, interval= 60, times = 5)
knitr::kable(head(result))


ytingc/rCTA documentation built on May 15, 2019, 1:12 p.m.