knitr::opts_chunk$set(collapse = T, comment = "#>")
options(tibble.print_min = 4L, tibble.print_max = 4L)
library(seoulsubway)

This document introduces you to seoulsubway's basic set of tools, and shows you how to apply them to sample data("subway_sample").

Data: subway_sample

data("subway_sample")
dim(subway_sample)
head(subway_sample)

Note that subway_sample is a data.table and data.frame. It contains 5000 obs(path sample) and 7 variables.

Seven variables include riding station, riding line, getting off station, getting off line, time, and number of passengers.

Introduction to functions.

Find path for sample data

Find shortestpath for zero transfer count

when you input arrival_line == depart_line path route.

shortestpath_0 will give you information about the shortest path to the subway when you don't transfer. also It considered circulate line #2

samplepath <- subway_sample[which(subway_sample$ID=="ID124"),]
samplepath
shortestpath_0(depart = samplepath$up_Name, depart_line = samplepath$up_Line,
             arrival = samplepath$down_Name, arrival_line = samplepath$down_Line)

Find shortestpath for one transfer count

shortestpath_1 will give you information about the shortest path to the subway when you do only one transfer.

samplepath <- subway_sample[which(subway_sample$ID=="ID142"),]
samplepath
shortestpath_1(depart = samplepath$up_Name, depart_line = samplepath$up_Line,
             arrival = samplepath$down_Name, arrival_line = samplepath$down_Line)

Find shortestpath for two transfer count

shortestpath_2 will give you information about the shortest path to the subway when you do two transfer.

samplepath <- subway_sample[which(subway_sample$ID=="ID10"),]
samplepath
shortestpath_2(depart = samplepath$up_Name, depart_line = samplepath$up_Line,
             arrival = samplepath$down_Name, arrival_line = samplepath$down_Line)

Find shortestpath for three transfer count

shortestpath_3 will give you information about the shortest path to the subway when you do three transfer.

samplepath <- subway_sample[which(subway_sample$ID=="ID10"),]
samplepath
shortestpath_3(depart = samplepath$up_Name, depart_line = samplepath$up_Line,
             arrival = samplepath$down_Name, arrival_line = samplepath$down_Line)

Find shortestpath in all case(transfer count : 0,1,2,3)

shortestpath will give you information about the shortest path to the subway in all case. we can compare these result with shortestpath_2 above.

when we input same path in shortestpath_2() and shortestpath(), but shortestpath() in all case get another path.

because shortestpath() will give you totally selected path from another three.

shortestpath(depart = samplepath$up_Name, depart_line = samplepath$up_Line,
             arrival = samplepath$down_Name, arrival_line = samplepath$down_Line)

plot map which includes shortestpath info.

path_plot will give you a map which includes shortestpath information.

It depends on 'nkmap' packages. i suggest to install nkmap in "subinjo92" 's github.

library(nkmap)

samplepath <- subway_sample[which(subway_sample$ID=="ID15"),]
samplepath

path_plot(depart = samplepath$up_Name, depart_line = samplepath$up_Line,
             arrival = samplepath$down_Name, arrival_line = samplepath$down_Line, naver_secret, naver_key, kakao_key, zoom =8)

samplepath <- subway_sample[which(subway_sample$ID=="ID30"),]
samplepath

path_plot(depart = samplepath$up_Name, depart_line = samplepath$up_Line,
             arrival = samplepath$down_Name, arrival_line = samplepath$down_Line, naver_secret, naver_key, kakao_key, zoom =7)

Introduction to sub-functions.

Introduction to analysis-functions.



king4k1/Seoulsubway documentation built on Nov. 17, 2019, 4:08 p.m.