lookup_info.Rmd
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:
bus_number | route_name |
---|---|
5 | South Shore Night Bus |
If bus number is not specified, it will provide a dataframe with the all the bus number with its corresponding route names.
bus_number | route_name |
---|---|
1 | Bronzeville/Union Station |
2 | Hyde Park Express |
3 | King Drive |
4 | Cottage Grove |
5 | South Shore Night Bus |
6 | Jackson Park Express |
7 | Harrison |
8 | Halsted |
8A | South Halsted |
9 | Ashland |
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))
dir |
---|
Eastbound |
Westbound |
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))
bus_num | direction | stop_id | stop_name | lat | lon |
---|---|---|---|---|---|
1 | Northbound | 1564 | 3000 S Michigan | 41.84061 | -87.62321 |
1 | Northbound | 12713 | Adams & Canal | 41.87929 | -87.63944 |
1 | Northbound | 17046 | Adams & Clark | 41.87946 | -87.63108 |
1 | Northbound | 1108 | Adams & S. Wacker | 41.87918 | -87.63610 |
1 | Northbound | 4732 | Adams & State | 41.87949 | -87.62809 |
1 | Northbound | 77 | Adams & Wabash | 41.87958 | -87.62597 |
1 | Northbound | 80 | Adams & Wells | 41.87923 | -87.63383 |
1 | Northbound | 1563 | Indiana & 31st Street | 41.83828 | -87.62187 |
1 | Northbound | 1562 | Indiana & 32nd Street | 41.83647 | -87.62184 |
1 | Northbound | 16119 | Indiana & 33rd Boulevard | 41.83493 | -87.62186 |
Get the information based on bus number 1 and stop name containing michigan
:
result <- lookupstop(bus = 1, stopname = "michigan")
knitr::kable(head(result, 10))
bus_num | direction | stop_id | stop_name | lat | lon |
---|---|---|---|---|---|
1 | Northbound | 1564 | 3000 S Michigan | 41.84061 | -87.62321 |
1 | Northbound | 1581 | Michigan & 11th Street | 41.86910 | -87.62397 |
1 | Northbound | 1579 | Michigan & 13th Street | 41.86617 | -87.62408 |
1 | Northbound | 18318 | Michigan & 14th Street | 41.86436 | -87.62404 |
1 | Northbound | 14760 | Michigan & 16th Street | 41.86048 | -87.62397 |
1 | Northbound | 1575 | Michigan & 18th Street | 41.85819 | -87.62386 |
1 | Northbound | 1573 | Michigan & 21st Street | 41.85455 | -87.62381 |
1 | Northbound | 1570 | Michigan & 23rd Street | 41.85137 | -87.62367 |
1 | Northbound | 15313 | Michigan & 24th Street | 41.84946 | -87.62367 |
1 | Northbound | 1568 | Michigan & 25th Street | 41.84738 | -87.62354 |
Get the information based on bus number 1 and direction southbound
:
result <- lookupstop(bus = 1, dir = "southbound")
knitr::kable(head(result, 10))
bus_num | direction | stop_id | stop_name | lat | lon |
---|---|---|---|---|---|
1 | Southbound | 1606 | 3000 S Michigan | 41.84045 | -87.62356 |
1 | Southbound | 67 | Jackson & Canal | 41.87801 | -87.64001 |
1 | Southbound | 14461 | Jackson & Chicago River | 41.87797 | -87.63851 |
1 | Southbound | 70 | Jackson & Dearborn | 41.87814 | -87.62949 |
1 | Southbound | 69 | Jackson & Financial Place | 41.87810 | -87.63287 |
1 | Southbound | 68 | Jackson & Franklin | 41.87807 | -87.63540 |
1 | Southbound | 71 | Jackson & State | 41.87816 | -87.62791 |
1 | Southbound | 72 | Jackson & Wabash | 41.87824 | -87.62532 |
1 | Southbound | 1590 | Michigan & 11th Street | 41.86892 | -87.62394 |
1 | Southbound | 1592 | Michigan & 13th Street | 41.86553 | -87.62399 |
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))
bus_num | direction | stop_id | stop_name | lat | lon |
---|---|---|---|---|---|
1 | Southbound | 1606 | 3000 S Michigan | 41.84045 | -87.62356 |
1 | Southbound | 1590 | Michigan & 11th Street | 41.86892 | -87.62394 |
1 | Southbound | 1592 | Michigan & 13th Street | 41.86553 | -87.62399 |
1 | Southbound | 1593 | Michigan & 14th Street | 41.86391 | -87.62414 |
1 | Southbound | 1595 | Michigan & 16th Street | 41.85997 | -87.62403 |
1 | Southbound | 1596 | Michigan & 18th Street | 41.85763 | -87.62405 |
1 | Southbound | 1598 | Michigan & 21st Street | 41.85404 | -87.62384 |
1 | Southbound | 16014 | Michigan & 23rd Street | 41.85130 | -87.62383 |
1 | Southbound | 17243 | Michigan & 24th Street | 41.84946 | -87.62383 |
1 | Southbound | 1602 | Michigan & 25th Street | 41.84723 | -87.62372 |