Learn R Programming

flows (version 1.0)

firstflowsg: Flow Selection Based on Global Criteria

Description

Flow selection based on global criteria.

Usage

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

Value

  • A boolean matrix of selected flows.

item

  • k
  • ties.method

link

rank

Details

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

See Also

firstflows, domflows

Examples

Run this code
# 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")

Run the code above in your browser using DataLab