# NOT RUN {
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
)
# }
Run the code above in your browser using DataLab