mob.data.array.route.level: Reduce a mob.data.array object to route-level

Description Usage Arguments Value Author(s) See Also Examples

View source: R/hmob_funcs.R

Description

This function reduces data array output from the mob.data.array function to a route-level matrix that contains the mean trip count. The mean trip count will represent the mean taken across whatever temporal interval was used in the mob.data.array function.

Usage

1

Arguments

x

An array produced by the mob.data.array function

variable

The variable in the array (expects either 'distance', 'duration', or 'movement')

Value

A 2-dimensional array when variable = 'distance' or 'movement', and a 3-dimensional array when variable = 'duration'. Cells give the mean trip count taken across the temporal interval of the input array.

Author(s)

John Giles

See Also

Other model processing: calc.decay.stats(), get.param.vals(), mob.data.array.pop.level()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Month-level movement matrix
m <- mob.data.array(orig=df$from,
                    dest=df$to,
                    time=df$month,
                    count=df$count,
                    name='movement')
str(m)

# Mean-monthly movement for each route
m2 <- mob.data.array.pop.level(m, 'movement')


# Route-level distance matrix
m <- mob.data.array(orig=df$from,
                    dest=df$to,
                    count=df$count,
                    variable=df$distance,
                    agg.int=10, # count trips per 10km intervals
                    name='distance')

# Mean trip counts at each 10km distance interval for each origin
m2 <- mob.data.array.route.level(m, 'distance')


# Month-level aggregated duration matrix 
m <- mob.data.array(orig=df$from,
                    dest=df$to,
                    time=df$month,
                    count=df$count,
                    variable=df$duration,
                    agg.int=3, # aggregated to a generation time of 3 days
                    name='duration')
str(m)

# Mean monthly trip duration count for each route
m2 <- mob.data.array.route.level(m, 'duration')

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