get.route.type: Get route-type

Description Usage Arguments Value Author(s) Examples

View source: R/hmob_funcs.R

Description

This function determines if a route is one of four types based on population density. The four route-types are:

  1. High density to high density (High:high)

  2. High density to low density (High:low)

  3. Low density to low density (Low:low)

  4. Low density to high density (Low:high)

Usage

1
get.route.type(x, orig, dest, hi, lo)

Arguments

x

A dataframe containing a column for the origin and a column for the destination

orig

column index of origin district

dest

column index of destination district

hi

vector of district IDs in the high density category

lo

vector of district IDs in the low density category

Value

A character vector giving the corresponding route type

Author(s)

John Giles

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
y.route <- load.obj(3, file='./data/duration_data_arrays_1day_full.Rdata') # y.month, y.route, y.pop
y.route <- get.subsamp(y.route, min.locations=30, min.samp=20)
districts <- dimnames(y.route)$origin
n.districts <- length(dimnames(y.route)$origin)

lam1 <- load.obj(1, './output/decay_1day_62dists_summary.Rdata')
lam1 <- get.param.vals(n.districts, name='lambda', stats=lam1, type='dataframe')

# clean
lam1$from <- districts[lam1$from]
lam1$to <- districts[lam1$to]

# Route type criteria
pop <- read.csv("./data/population_data.csv")
cutoff <- 980
hi <- pop$ID_2[pop$density >= cutoff]
lo <- pop$ID_2[pop$density < cutoff]

lam1$type <- get.route.type(lam1, orig=2, dest=3, hi=hi, lo=lo)

gilesjohnr/hmob documentation built on Aug. 8, 2020, 1:26 a.m.