-
Notifications
You must be signed in to change notification settings - Fork 12
/
README.qmd
86 lines (58 loc) · 3.58 KB
/
README.qmd
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
---
format: gfm
execute:
message: false
warning: false
eval: false
default-image-extension: ""
---
# Flowmap.blue R widget <a href="https://flowmapblue.github.io/flowmapblue.R/"><img src="man/figures/logo.png" align="right" width="200" alt="flowmapblue website" /></a>
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/flowmapblue)](https://CRAN.R-project.org/package=flowmapblue){target="_blank"}
[![CRAN/METACRAN Total downloads](https://cranlogs.r-pkg.org/badges/grand-total/flowmapblue?color=blue)](https://CRAN.R-project.org/package=flowmapblue){target="_blank"}
[![CRAN/METACRAN Downloads per month](https://cranlogs.r-pkg.org/badges/flowmapblue?color=blue)](https://CRAN.R-project.org/package=flowmapblue){target="_blank"}
[![R-CMD-check](https://github.com/FlowmapBlue/flowmapblue.R/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/FlowmapBlue/flowmapblue.R/actions/workflows/R-CMD-check.yaml){target="_blank"}
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental){target="_blank"}
[![DOI](https://zenodo.org/badge/DOI/10.32614/CRAN.package.flowmapblue.svg)](https://doi.org/10.32614/CRAN.package.flowmapblue)
<!-- badges: end -->
WORK IN PROGRESS
This is a [Flowmap.blue](https://www.flowmap.blue/) widget for R. Create interactive flow maps using [`FlowmapBlue`](https://github.com/FlowmapBlue/FlowmapBlue) TypeScript library, which is a free tool for representing aggregated numbers of movements between geographic locations as flow maps. It is used to visualize urban mobility, commuting behavior, bus, subway and air travels, bicycle sharing, human and bird migration, refugee flows, freight transportation, trade, supply chains, scientific collaboration, epidemiological and historical data and many other topics. The package allows to either create standalone flow maps in form of 'htmlwidgets' and save them in 'HTML' files, or integrate flow maps into 'Shiny' applications.
You might also consider using this pure R flowmapping library based on `ggplot2`: https://github.com/JohMast/flowmapper
![](man/figures/demo.png)
As an alternative, you may also consider using R to populate a spreadsheet for publishing on [Flowmap.blue](https://www.flowmap.blue/)
as described in this [excellent blog post](https://doodles.mountainmath.ca/blog/2020/01/06/flow-maps/).
### Installation
Install from CRAN:
```{r}
install.packages("flowmapblue")
```
To install the development version from GitHub you will need to install `remotes` if you don't have it yet:
```{r}
if (!require("remotes")) install.packages("remotes")
remotes::install_github("FlowmapBlue/flowmapblue.R",
force = TRUE, dependencies = TRUE)
```
### Quick example
Setup your Mapbox access token. You can obtain a free token by signing up at [Mapbox](https://account.mapbox.com/).
```{r}
#| eval: false
Sys.setenv(MAPBOX_API_TOKEN = "YOUR_MAPBOX_ACCESS_TOKEN")
```
```{r}
library(flowmapblue)
# load locations and flows for Switzerland
data(ch_locations)
data(ch_flows)
flowmap <- flowmapblue(
ch_locations,
ch_flows,
mapboxAccessToken = Sys.getenv('MAPBOX_API_TOKEN'),
clustering = TRUE,
darkMode = TRUE,
animation = FALSE
)
# view the map
flowmap
```
Here is a [nice intro blog post](https://www.paulamoraga.com/blog/2020-07-11-mobility.html) by Paula Moraga.
For more examples with time and date in flows data, as well as integration with Shiny, see the Quick Start vignette and documentation for the package functions at [https://flowmapblue.github.io/flowmapblue.R/](https://flowmapblue.github.io/flowmapblue.R/).