compmat: Comparison of Two Matrices

Description Usage Arguments Value See Also Examples

Description

Compares two matrices of same dimension, with same column and row names.

Usage

1
compmat(mat1, mat2, digits = 0)

Arguments

mat1

A square matrix of flows.

mat2

A square matrix of flows.

digits

An integer indicating the number of decimal places to be used when printing the data.frame in the console (see round).

Value

A data.frame that provides statistics on differences between mat1 and mat2: absdiff are the absolute differences and reldiff are the relative differences (in percent).

See Also

statmat

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 dominant flows (incoming flows criterion)
flowSel1 <- domflows(mat = myflows, w = colSums(myflows), k = 1)
# Select the first flows
flowSel2 <- firstflows(mat = myflows, method = "nfirst", ties.method = "first",
                       k = 1)
# Select flows greater than 2000
flowSel3 <- firstflows(mat = myflows, method = "xfirst", k = 2000)

# Combine selections
flowSel <- myflows * flowSel1 * flowSel2 * flowSel3

# Compare flow matrices
compmat(mat1 = myflows, mat2 = flowSel, digits = 1)

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