Description Usage Arguments Value Author(s) Examples
This function determines if a route is one of four types based on population density. The four route-types are:
High density to high density (High:high)
High density to low density (High:low)
Low density to low density (Low:low)
Low density to high density (Low:high)
1 | get.route.type(x, orig, dest, hi, lo)
|
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 |
A character vector giving the corresponding route type
John Giles
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.