Bus_Distance: Retrieve the distance between stops of each bus routes

Bus_DistanceR Documentation

Retrieve the distance between stops of each bus routes

Description

The function is used to download the distance of any two adjacent stops for a specific route. It supports to download data of city buses and intercity buses. Note that the function can retrieve the data of single or mutiple bus routes.

Usage

Bus_Distance(access_token, county, routeid, out=F)

Arguments

access_token

Your access token given by TDX platform. This can be derived from the function get_token().

county

Please fill in the English county name. Checking out the appropriate county name in dataframe TDX_County. If Intercity is used, the function retrieves the intercity bus data.

routeid

The specific RouteID that should be retrive for its travel time. This can be a character or a vector. Please ensure that the RouteID must contain in the county; otherwise, it would retrieve nothing.

out

If the result should be exported to the local, please fill in the directory. The default value is FALSE, which does not export the data.

Value

Some columns definition are listed below.

RouteID This is the main key of this table.
SubRouteID There might exists two or more SubRouteID due to the different direction of sub-route.
FromStopID The origin stops.
ToStopID The destination stops.
StartHour The start hour of the travel time data.
EndHour The end hour of the travel time data. Note that the data is recorded meticulously with one hour interval in some counties (e.g.,Taipei), while most of data is recoreded in a longer interval, that is, the difference between StartHour and EndHour is usually larger than 1.
Distance The distance of each adjacent stops of a specific sub-route."

Codes of Direction are listed below.

0 outbound
1 inbound
2 loop
255 unknown

Author(s)

Maintainer: Chia Jung, Yeh chia-jung.yeh@sydney.edu.au

Examples

# routeid can be a character
Bus_Distance(access_token, "Taipei", "10132")

# routeid can also be a vector
Bus_Distance(access_token, "Taipei", c("10132", "10142"))

# routeid can be retrieve from the function Bus_Route()
temp=Bus_Route(access_token, "Hsinchu")
Bus_Distance(access_token, "Hsinchu", unique(temp$RouteID), out="./Hsinchu_BusDist.csv")

ChiaJung-Yeh/NYCU_TDX documentation built on Nov. 25, 2024, 6:57 a.m.