compare_mat | R Documentation |
Compares two matrices of same dimension, with same column and row names.
compare_mat(mat1, mat2, digits = 0)
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). |
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).
# # Import data
nav <- read.csv(system.file("csv/nav.csv", package = "flows"))
mat <- prepare_mat(x = nav, i = "i", j = "j", fij = "fij")
# Remove the matrix diagonal
diag(mat) <- 0
# Select the first flows
flowSel1 <- select_flows(mat = mat, method = "nfirst", k = 1)
# Select flows greater than 2000
flowSel2 <- select_flows(mat = mat, method = "xfirst", k = 2000)
# Combine selections
flowSel <- mat * flowSel1 * flowSel2
# Compare flow matrices
compare_mat(mat1 = mat, mat2 = flowSel, digits = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.