Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/datagistips/geosparklines
An R Package to put SparkLines on a Map
https://github.com/datagistips/geosparklines
Last synced: 3 months ago
JSON representation
An R Package to put SparkLines on a Map
- Host: GitHub
- URL: https://github.com/datagistips/geosparklines
- Owner: datagistips
- License: lgpl-3.0
- Created: 2020-04-18T13:13:45.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-04-27T16:15:34.000Z (over 4 years ago)
- Last Synced: 2024-05-21T02:10:46.536Z (6 months ago)
- Language: R
- Homepage:
- Size: 547 KB
- Stars: 32
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - datagistips/geosparklines - An R Package to put SparkLines on a Map (R)
README
# geosparklines
`geosparklines` is an R package that you can use to create SparkLines as SimpleFeatureCollection (`sfc`) objects which can be further put on a map
## Quick Start
### Installation
```r
devtools::install_github("datagistips/geosparklines", build_vignettes = TRUE)
```### Usage
Crteate geosparklines from a data frame
```r
library(geosparklines)
library(readr)
library(sf)f <- read_csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv") # it's John Hopkins Institute Data
geosparks <- geospark(coords = f[, c("Long", "Lat")], my_stats = f[, 5:ncol(f)], width = 20, height = 20, mode = "log") # log transformed sparklines as an sfc (Simple Feature Collection)
st_geometry(f) <- geosparks
```Or individual geosparklines, for which you can control the width, height, direction based on data
```r
sp_line <- singleGeospark(my_coords, v, width=20, height=20, direction="ne", mode="log")
```There is also a method for generating sparklines inspired by FT Dataviz designer John Burn-Murdoch.
```r
sp_line <- geosparkBM(my_coords, my_values, width=3, height=4, n = 21, direction = "ne"))
```Here are for example four geosparklines with varying widths, heights, and directions illustrating the evolution of covid-19 cases in France
![](vignettes/Rplot.png)
### Vignettes
- [Meet geosparklines with a reproducible example](vignettes/how-to-use-geosparklines.html)
- [See how to reproject your data to an Equal Area projection like Plate Carrée](vignettes/how-to-reproject-to-a-custom-plate-carree.html)
- [Put John Burn Murdoch's smoothed Sparklines on a map](vignettes/how-to-use-burn-murdoch-method.html)## Rendering
You can render data in R, for instance with `ggplot` or `leaflet`Also, you can export data :
```r
st_write(f, "data/my_geosparlines.gpkg) ## f is the sf object generated above
```Then render it in [QGIS](https://www.qgis.org/)
Here is a map of covid cases in France, rendered in QGIS :
## License
License : GPL-3
Author : Mathieu Rajerison