Bus routes in the Helsinki metropolitan area: Difference between revisions

From Opasnet
Jump to navigation Jump to search
(Created page with "{{variable|moderator=|stub=Yes}} Category:Composite traffic == Question == What are the routes of bus-lines running in the Helsinki metropolitan area? == Answer == {{resu...")
 
(data extraction explained)
Line 13: Line 13:


See [[Composite traffic]] and [[File:Composite traffic.ANA]].
See [[Composite traffic]] and [[File:Composite traffic.ANA]].
Data was exported from the All bus routes node in Analytica and transformed using the following R code.
<nowiki>bus.routes <- read.table("M:/Composite traffic/Bus_routes.txt", fill = TRUE, sep = "\t")
temp <- strsplit(as.character(bus.routes[4:nrow(bus.routes),2]), ",")
bus.routes <- data.frame(bus.routes[rep(4:nrow(bus.routes), sapply(temp, length)), c(1,3)], unlist(temp))
colnames(bus.routes) <- c("Route_id", "Time_id", "Result")
bus.routes$Route_order <- 1
while(nrow(bus.routes[duplicated(bus.routes[,c("Route_id", "Time_id", "Route_order")]),]) > 0) {
bus.routes$Route_order <- ifelse(duplicated(bus.routes[,c("Route_id", "Time_id", "Route_order")]), bus.routes$Route_order + 1,
bus.routes$Route_order)
}</nowiki>


==See also==
==See also==

Revision as of 10:06, 19 August 2011

Question

What are the routes of bus-lines running in the Helsinki metropolitan area?

Answer

{{#opasnet_base_link:Op_en5336}}


Rationale

See Composite traffic and File:Composite traffic.ANA.

Data was exported from the All bus routes node in Analytica and transformed using the following R code.

bus.routes <- read.table("M:/Composite traffic/Bus_routes.txt", fill = TRUE, sep = "\t")

temp <- strsplit(as.character(bus.routes[4:nrow(bus.routes),2]), ",")
bus.routes <- data.frame(bus.routes[rep(4:nrow(bus.routes), sapply(temp, length)), c(1,3)], unlist(temp))
colnames(bus.routes) <- c("Route_id", "Time_id", "Result")
bus.routes$Route_order <- 1
while(nrow(bus.routes[duplicated(bus.routes[,c("Route_id", "Time_id", "Route_order")]),]) > 0) {
	bus.routes$Route_order <- ifelse(duplicated(bus.routes[,c("Route_id", "Time_id", "Route_order")]), bus.routes$Route_order + 1, 
	bus.routes$Route_order)
}

See also

Keywords

References


Related files

<mfanonymousfilelist></mfanonymousfilelist>