knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
devtools::install_github("ytingc/rCTA",build_vignettes = TRUE) library(rCTA)
This vignette covers how to use function get_route()
, get_direction
, and lookupstop()
in the rCTA
package. They allow users to lookup various information of buses including routes, direction, stop ID, and stop name.
Function get_route()
allows to get route names based on your specified bus number. The following example shows how to get the route name of bus number 126:
result <-get_route(bus = 5) knitr::kable(head(result))
If bus number is not specified, it will provide a dataframe with the all the bus number with its corresponding route names.
result <- get_route() knitr::kable(head(result, 10))
Function get_direction
allows to look up direction of a specified bus number. The following example shows how to get the route name of bus number 126:
result <- get_direction(bus = 126) knitr::kable(head(result))
Function lookupstop
is particularly useful when stop ID is unknown. This function allows people to look up stops information based on the bus number(required), stop name(optional), and direction(optional). Arguments are case insensitive. It will generate a dataframe with potential matching stop in rows with the following columns:
Get the information based on bus number 1:
result <- lookupstop(bus = 1) knitr::kable(head(result, 10))
Get the information based on bus number 1 and stop name containing michigan
:
result <- lookupstop(bus = 1, stopname = "michigan") knitr::kable(head(result, 10))
Get the information based on bus number 1 and direction southbound
:
result <- lookupstop(bus = 1, dir = "southbound") knitr::kable(head(result, 10))
Get the information based on bus number 1 and stop name containing michigan
and southbound
:
result <- lookupstop(bus = 1, stopname = "Michigan", dir = "Southbound") knitr::kable(head(result, 10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.