-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
91 lines (74 loc) · 3 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/",
fig.width = 7, fig.height = 8,
dev = "png"
)
```
# `flows`: Selections on flow matrices, statistics on selected flows, cartographic and graphic visualizations <img src="man/figures/logo.png" align="right" width="140"/>
<!-- badges: start -->
[![Version](http://www.r-pkg.org/badges/version/flows)](https://cran.r-project.org/package=flows/)
[![R-CMD-check](https://github.com/riatelab/flows/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/riatelab/flows/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
The analysis and representation of flows often presuppose a selection
to facilitate interpretation. Various methods have been proposed for selecting
flows, one of the most widely used being based on major flows: it selects only
the most important flows, absolute or relative, on a local or global scale.
These methods often highlight hierarchies between locations, but the loss of
information caused by selection is rarely taken into account. It therefore
seems useful to propose statistical indicators to assess the loss of information
and the characteristics of selected flows. We provide functions that select
flows (main, dominant or major flows), provide statistics on selections and
offer visualizations in the form of maps and graphs.
## Installation
You can install the development version of flows from GitHub with:
```{r, eval = FALSE}
remotes::install_github("riatelab/flows")
```
## Usage
Example of a dominant flows analysis on commuters data:
```{r, warning=FALSE, message=FALSE}
library(sf)
library(flows)
library(mapsf)
# Import datasets
nav <- read.csv(system.file("csv/nav.csv", package = "flows"))
# Trnasform to wide
mat <- prepare_mat(x = nav, i = "i", j = "j", fij = "fij")
# import spatial objects
UA <- st_read(system.file("gpkg/GE.gpkg", package = "flows"),
layer = "urban_area", quiet = TRUE
)
GE <- st_read(system.file("gpkg/GE.gpkg", package = "flows"),
layer = "region", quiet = TRUE
)
# Map
mf_map(GE, col = "#c6deba")
out <- map_nodal_flows(
mat = mat, x = UA,
inches = .17,
col_node = c("red", "orange", "yellow"),
col_flow = "grey30",
breaks = c(4, 100, 1000, 2500, 8655),
lwd = c(1, 4, 8, 16), add = TRUE
)
mf_label(out$nodes[out$nodes$w > 6000, ],
var = "name",
halo = TRUE, overlap = FALSE, pos = 4
)
mf_title("Dominant Flows of Commuters")
mf_credits("INSEE, 2011")
mf_scale(50)
```
## Ressources
* [Beauguitte, L., Giraud, T. et Guérois, M. (2015). Un outil pour la sélection et la visualisation de flux : le package flows. Netcom, 29(3/4), 399-408.](https://journals.openedition.org/netcom/2134) <small>(This paper is in French and refers to previous versions of the package.)</small>
* Package vignette
## Community Guidelines
One can contribute to the package through [pull
requests](https://github.com/riatelab/flows/pulls) and report issues or
ask questions [here](https://github.com/riatelab/flows/issues).