firstflows: Flow Selection from Origins

Description Usage Arguments Details Value See Also Examples

Description

Flow selection from origins.

Usage

1
firstflows(mat, method = "nfirst", ties.method = "first", k)

Arguments

mat

A square matrix of flows.

method

A method of flow selection, one of "nfirst", "xfirst" or "xsumfirst":

  • nfirst selects the k first flows from origins,

  • xfirst selects flows greater than k,

  • xsumfirst selects as many flows as necessary for each origin so that their sum is at least equal to k. If k is not reached for one origin, all its flows are selected.

ties.method

In case of equality with "nfirst" method, use "random" or "first" (see rank).

k

Selection threshold.

Details

As the output is a boolean matrix, use element-wise multiplication to get flows intensity.

Value

A boolean matrix of selected flows.

See Also

firstflowsg, domflows

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
# Import data
data(nav)
myflows <- prepflows(mat = nav, i = "i", j = "j", fij = "fij")

# Remove the matrix diagonal
diag(myflows) <- 0

# Select the 2 first flows of each origin
flowSel <- firstflows(mat = myflows, method = "nfirst", ties.method = "first",
                      k = 2)
statmat(mat = myflows * flowSel, output = "none")

# Select flows greater than 2000
flowSel <- firstflows(mat = myflows, method = "xfirst", k = 2000)
statmat(mat = myflows * flowSel, output = "none")

# Select as many flows as necessary for each origin so that their sum is at
# least equal to 20000
flowSel <- firstflows(myflows, method = "xsumfirst", k = 20000)
statmat(mat = myflows * flowSel, output = "none")

# Select each flows that represent at least 10% of the outputs
myflowspct <- myflows / rowSums(myflows) * 100
flowSel <- firstflows(mat = myflowspct, method = "xfirst", k = 10)
statmat(mat = myflows * flowSel, output = "none")

flows documentation built on May 2, 2019, 7:25 a.m.