flowcarre {cartograflow}R Documentation

Builds a square matrice from geographical nodes

Description

Builds a square and closed matrice from a dataframe of spatial nodes

Usage

flowcarre(liste, tab, origin, dest, valflow, empty.sq, format, diagonale)

Arguments

liste

list of all the spatial codes as a single dataframe

tab

the non squared input flow dataset with three column : origin, destination, flow value

origin

node / place of origin of the flow

dest

node / place of destination of the flow

valflow

is the flow value between origin and destination places

empty.sq

Builds an empty matrix or not. See Details.

format

is the desired squared flow dataset output format. See Details.

diagonale

to zero or not the main diagonal. See Details.

Details

- empty.sq is "TRUE" builds an empty matrix ; else is "FALSE" or missing

- format is "M" for matrice format
- format is "L" for long format, as three column dataframe

- diagonal is "TRUE" to zero the main diagonal

Examples

library(cartograflow)
data(flowdata)
var1 <- geoid
var2 <- flows

# 1/2 Compute an empty square matrice with ID code, and sets the value to zero
# Example for matrice format (same procedure for the long format)

mat <- flowcarre(var1, var2,
  origin = "i", dest = "j", valflow = "Fij",
  format = "M", empty.sq = TRUE
)

# 2/2 Fill in the matrice with external flow values
mat <- flowcarre(var1, var2,
  origin = "i", dest = "j", valflow = "Fij",
  format = "M", empty.sq = FALSE
)

# Square a matrice and zero the main diagonal
mat <- flowcarre(var1, var2,
  origin = "i", dest = "j", valflow = "Fij", format = "M",
  empty.sq = FALSE, diagonale = FALSE
)

[Package cartograflow version 1.0.5 Index]