Description Usage Arguments Details Value See Also Examples
Generates Spatial Sparklines as Simple Feature Collection (sfc) based on a method by Financial Times Data Visualization Designer John Burn-Murdoch
1 | geosparkBM(coords, my_stats, width, height, direction = "ne", n = 7)
|
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) |
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
returns a geometry collection (sfc)
geosparklines::singleGeosparkBM()
, browseVignettes("geosparklines")
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.