Package 'ssrn'

Title: Scan Statistics for Railway Network
Description: Implement the algorithm provided in scan for estimating the transmission route on railway network using passenger volume. It is a generalization of the scan statistic approach for railway network to identify the hot railway route for transmitting infectious diseases.
Authors: Shinya Uryu [aut, cre] , Yuta Tanoue [aut], Daisuke Yoneoka [aut]
Maintainer: Shinya Uryu <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2024-11-20 03:04:00 UTC
Source: https://github.com/uribo/ssrn

Help Index


East Japan Railway's Tokaido Line Data

Description

East Japan Railway's Tokaido Line Data

Details

Includes the names of stations between Tokyo and Yugawara as of June 2020.

  • st_code: A unique number to identify the station.

  • st_name: Romanization of station names.

Value

  • jreast_jt a tibble


JR-East Tokaido Line OD Data

Description

JR-East Tokaido Line OD Data

Details

Census values made in 2015. The number of passengers between stations on the Tokaido Line. These values are those of commuter pass users.

  • departure_st_code: Departing station identification number.

  • arrive_st_code: The identification number of the station you are arriving at.

  • volume Number of people getting on and off the train.

Value

  • jreast_jt_od a tibble

See Also

https://www.mlit.go.jp/sogoseisaku/transport/sosei_transport_tk_000035.html


Convert station data to adjacency matrix

Description

Convert station data to adjacency matrix

Usage

make_adjacency_matrix(stations, depart, arrive)

Arguments

stations

data.frame which set of stopping points recorded in order of stopping.

depart

Column name of a stop.

arrive

Give the name of the column indicating the next stop at the target stop.

Examples

make_adjacency_matrix(jreast_jt, st_code, next_st_code)

Convert passenger and station data to origin-destination matrix

Description

Convert passenger and station data to origin-destination matrix

Usage

make_passenger_matrix(passenger, stations, depart, arrive, location, value)

Arguments

passenger

passenger data

stations

data.frame which set of stopping points recorded in order of stopping.

depart

Column name of a stop.

arrive

Give the name of the column indicating the next stop at the target stop.

location

Name of the variable to use for the join, indicating its location.

value

origin-destination value name

Examples

jreast_jt_od %>%
  make_passenger_matrix(jreast_jt,
                        departure_st_code,
                        arrive_st_code,
                        st_code,
                        volume)

Summaries a passenger volume

Description

Summaries a passenger volume

Usage

make_passenger_od(
  passenger,
  stations,
  depart,
  arrive,
  location,
  value,
  .all = FALSE
)

Arguments

passenger

passenger data

stations

data.frame which set of stopping points recorded in order of stopping.

depart

Column name of a stop.

arrive

Give the name of the column indicating the next stop at the target stop.

location

Name of the variable to use for the join, indicating its location.

value

origin-destination value name

.all

Make a join that contains rows of two datasets. The default value is FALSE.

Examples

jreast_jt_od %>%
  make_passenger_od(jreast_jt,
                    depart = departure_st_code,
                    arrive_st_code,
                    location = st_code,
                    value = volume) %>%
 dplyr::left_join(jreast_jt %>%
                    dplyr::select(arrive_st_code = st_code,
                                  next_st_name = st_name),
                   by = "arrive_st_code")

Create network window zones

Description

Create network window zones

Usage

network_window(adjacency_matrix, dist_matrix, type, cluster_max)

Arguments

adjacency_matrix

A boolean matrix, with element (i,j) set to TRUE if location j is adjacent to location i.

dist_matrix

Distance matrix

type

Currently, "connected_B" only.

cluster_max

Maximum cluster size. Zone If this value is reached, the area will not be expanded any further. It's a good idea to keep it to the number of stops on the line you're dealing with.


Create transit table

Description

Create transit table

Usage

transit_table(stations, ..., reverse = FALSE)

Arguments

stations

data.frame which set of stopping points recorded in order of stopping.

...

Arguments passed on to dplyr::across

.cols

<tidy-select> Columns to transform. Because across() is used within functions like summarise() and mutate(), you can't select or compute upon grouping variables.

reverse

Option to swap the order of the stopping points.

Examples

# The next stop is stored in the variable of column next_.
jreast_jt %>%
  transit_table()
# Switch between inbound and outbound lines.
jreast_jt %>%
  transit_table(reverse = TRUE)