Bus_Schedule: Retrieve the schedule of each bus routes

View source: R/TDX.R

Bus_ScheduleR Documentation

Retrieve the schedule of each bus routes

Description

The function is used to download the bus schedule. And it supports to download data of city buses and intercity buses. Note that the schedule is recorded in two forms, including timetable and frequency. Some cities (e.g., Taipei) record in both two methods, and they would be merged together in this function. Most of the cities only record in the schedule form.

Usage

Bus_Schedule(access_token, county, dates=F, 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.

dates

If historical data would be retrieved, this argument should be set; otherwise the default value is FALSE. The date format should be YYYY-MM-DD.

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.

RouteUID It contains every subroutes and directions in a same RouteUID.
SubRouteUID If the direction or subroute is not the same, a different SubRouteUID must be recorded.
TripID It is used to record the sequence of Trips. It only occurs when the schedule is recorded in timetable format.
Sunday If the trip is operated in that day, it is recorded in 1; ortherwise, 0. Other days are the same.
Date Use to record some special hoildays.
ServiceStatus Use to record the service status in special hoildays, including "Operating As Usual" and "Cancelling Operation."
ArrivalTime The arrival time of the bus. This is only recorded in timetable format.
DepartureTime The departure time of the bus. This is only recorded in timetable format.
StartTime The start time of the specific frequency data. This is only recorded in frequency format.
EndTime The end time of the specific frequency data. This is only recorded in frequency format.
MinHeadwayMins The minimum headway of the specific frequency data. This is only recorded in frequency format.
MaxHeadwayMins The maximum headway of the specific frequency data. This is only recorded in frequency format.

Codes of Direction are listed below.

0 outbound
1 inbound
2 loop
255 unknown

Codes of BusRouteType are listed below.

11 City Bus
12 Intercity Bus (Normal)
13 Intercity Bus (Freeway)
14 Feeder bus

Author(s)

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

Examples

Bus_Schedule(access_token, "Taipei")
Bus_Schedule(access_token, "Hsinchu", out="./Hsinchu_Schedule.csv")

# historical data
Bus_Schedule(access_token, "Hsinchu", "2022-01-01")

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