finger_plan: DF transform to finger plan urban model

Description Usage Arguments Value Examples

View source: R/finger_plan.R

Description

This function allows you to change the origins and destination of flows stored into a dataframe to simulate a finger-plan urban model. Cities containing railroad station are designed as candidate and flows (origins and destinations) are moved from non-candidate cities to the nearest candidate cities (using osm network)

Usage

1
finger_plan(pol, idpol, cand, tabflows, idori, iddes, idflow)

Arguments

pol

An sf object of the cities

idpol

A character string of the column containing the id of the pol object

cand

A character string of the column containing binary (1, 0) candidate value of the pol object (1 must be equal to city containing a railroad station)

tabflows

A data.frame of flows between origins and destinations (long format matrix containing, at least, origins, destinations, flows)

idori

A character string giving the origin field name in tabflows

iddes

A character string giving the destination field name in tabflows

idflow

A character string giving the flow field name in tabflows

Value

A data.frame of flows as tabflows with origins and destinations changed

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Import data

idpol <- "idpol"
cand <- "cand"
data(polL93)
data(tabflows)
idori <- "ORI"
iddes <- "DES"
idflow <- "FLOW"

polL93$cand <- sample(0:1, size = nrow(polL93), replace = TRUE)

fg_flows <- finger_plan(
pol = polL93,
idpol = idpol,
cand = cand,
tabflows = tabflows,
idori = idori,
iddes = iddes,
idflow = idflow)

fg_flows[1:10,]

Geographie-cites/toyspace documentation built on July 11, 2019, 6:07 p.m.