firstflowsg: Flow Selection Based on Global Criteria

Description Usage Arguments Details Value See Also Examples

Description

Flow selection based on global criteria.

Usage

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

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 of the matrix,

  • xfirst selects flows greater than k,

  • xsumfirst selects as many flows as necessary so that their sum is at least equal to k.

k

Selection threshold.

ties.method

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

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

firstflows, domflows

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Import data
data(nav)
myflows <- prepflows(mat = nav, i = "i", j = "j", fij = "fij")

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

# Select the 50 first flows of the matrix
flowSel <- firstflowsg(mat = myflows, method = "nfirst", ties.method = "first",
                       k = 50)
statmat(mat = myflows * flowSel, output = "none")

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

# Select flows that represent at least 50% of the matrix flows
k50 <- sum(myflows)/2
flowSel <- firstflowsg(mat = myflows, method = "xsumfirst", k = 150000)
statmat(mat = myflows * flowSel, output = "none")

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