| flowreduct {cartograflow} | R Documentation | 
Flow matrix reduction according to another matrix
Description
Reduces a flow dataset according to an external matrix, eg. a matrix of travelled distance.
 
Builds geographical movements,  by weighting a flow dataset according to a distance criterion.
Usage
flowreduct(tab, tab.metric, metric, d.criteria, d)
Arguments
tab | 
 is the input flowdata set  | 
tab.metric | 
 the distance dataset  | 
metric | 
 select "continuous" or "ordinal" metric. See Details  | 
d.criteria | 
 is for selecting "dmin" or "dmax" distance criteria for "continuous" metric. See Details.  | 
d | 
 is the value of the selected "dmin" or "dmax". see Details  | 
Details
The involved metric can be continous or not.
(1) Metric is 'continous" for distance as euclidian, maximum, manhattan, etc.
See flowdist 
- Metric is 'ordinal" for computing neighbourhood ordinal distance matrix.
– Select ="dmin" for reducing flow dataset to flow values that are up or equal to the dmin distance parameter  (Fij>=dmin);
– select ="dmax" for reducing flow dataset to values that are less or equal to the dmax distance parameter(Fij=<dmin).
 
- Metric is 'ordinal' for computing neighbourhood ordinal distance with k contiguity.
See flowcontig for computing ordinal distance matrix 
Value
A flow dataset with distances computations and flow reduction
Examples
library(cartograflow)
library(sf)
library(dplyr)
data(flowdata)
map <- st_read(system.file("shape/MGP_TER.shp", package = "cartograflow"))
tab <- flowjointure(
  geom = "area", bkg = map, DF.flow = flows, origin = "i", destination = "j",
  id = "EPT_NUM", x = "X", y = "Y"
)
# Example for reducing a flow matrice with a distance matrice, in long format (i,j, distance)
## 1/2: Computes the matrice distances
tab.distance <- flowdist(tab, dist.method = "euclidian", result = "dist")
tab.distance <- tab.distance %>% select(i, j, distance)
## 2/2: Reduce the flow matrice
tab.flow <- flowreduct(flows, tab.distance,
  metric = "continous",
  d.criteria = "dmax", d = 8567
)