Skip to content

Instantly share code, notes, and snippets.

View davidsjoberg's full-sized avatar

David Sjoberg davidsjoberg

View GitHub Profile
library(tidyverse)
library(ggsankey)
## data via https://ourworldindata.org/grapher/total-agricultural-area-over-the-long-term
hablar::set_wd_to_script_path()
df <-
read_csv("total-agricultural-area-over-the-long-term.csv") %>%
janitor::clean_names() %>%
library(tidyverse)
library(ggsankey)
library(gapminder)
df <- gapminder %>%
group_by(continent, year) %>%
summarise(gdp = (sum(pop * gdpPercap)/1e9) %>% round(0), .groups = "keep") %>%
ungroup()
ggplot(df, aes(x = year,
library(ggbump)
library(tidyverse)
# ** StatSigmoidArea ------------------------------------------------------------------
StatSigmoidArea <- ggplot2::ggproto("StatSigmoidArea", ggplot2::Stat,
setup_data = function(data, params) {
data <- data %>%
dplyr::group_by(PANEL) %>%
dplyr::mutate(group = dplyr::row_number()) %>%