# firstflows

0th

Percentile

##### Flow Selection from Origins

Flow selection from origins.

##### Usage
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.

• firstflows
##### Examples
# 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")

Documentation reproduced from package flows, version 1.1.1, License: GPL-3

### Community examples

Looks like there are no examples yet.