Learn R Programming

cartograflow (version 1.0.0)

flowcarre: Create a square matrice from geographical ID

Description

Create a closed and square matrice from a list of geographic ID

Usage

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

Arguments

liste

list or all the geographical ID as a single vector flow dataset

tab

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

origin

origin place

dest

destination place

valflow

flow value

empty.sq

TRUE : to allows to have an matrice empty with only the ID of background map ; FALSE or missing

format

the squared flow dataset output format. See Details.

diagonale

See Details.

Details

- format is "M" for matrice format

- format is "L" for long format

- diagonal is "TRUE" to zero the main diagonal

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab