geosparkBM: Generates averaged Spatial Sparklines as Simple Feature...

Description Usage Arguments Details Value See Also Examples

View source: R/geosparkBM.R

Description

Generates Spatial Sparklines as Simple Feature Collection (sfc) based on a method by Financial Times Data Visualization Designer John Burn-Murdoch

Usage

1
geosparkBM(coords, my_stats, width, height, direction = "ne", n = 7)

Arguments

coords

Points coordinates

my_stats

Values associated to points as a column-wise (long) format. For instance, one column = one date

width

Width of the line

height

Height of the line

direction

Direction of lines, upward (north), downward (south), left (west) or right (east). For instance, "ne" will generate upward right lines.

n

Window size (default = 7)

Details

This function calculates sparklines and is based on a calculation by Financial Times Data Visualization Designer John Burn-Murdoch When covering covid-19 crisis, he calculated a 7-day moving average (also called rolling average) of the covid-19 cases then log-transformed it This method helps capture the dynamics of an exponential growth of the virus spread Notably, it helps figure out the subtle details of slowdown of the spread You can pilot the rendering of individual lines with finer details, with singleGeosparkBM

Value

returns a geometry collection (sfc)

See Also

geosparklines::singleGeosparkBM(), browseVignettes("geosparklines")

Examples

1
2
3
4
5
6
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")
geosparksBM <- geosparkBM(f[, c('Long', 'Lat')], f[, 5:ncol(f)], width=20, height=20, n = 7) # Choose a
plot(geosparksBM)
st_geometry(f) <- geosparksBM

datagistips/geosparklines documentation built on April 28, 2020, 3:03 p.m.