An open API service indexing awesome lists of open source software.

https://github.com/riatelab/flows

Flow selection and analysis
https://github.com/riatelab/flows

cran flows r r-package

Last synced: about 1 year ago
JSON representation

Flow selection and analysis

Awesome Lists containing this project

README

          

---
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

[![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)

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) (This paper is in French and refers to previous versions of the package.)
* 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).