Last active
January 24, 2018 05:14
-
-
Save ikashnitsky/2f6e29acbb9cbeb1694630c5932b8ad5 to your computer and use it in GitHub Desktop.
Global convergence in male life expectancy at birth since 1950
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# | |
# ikashnitsky.github.io 2017-07-17 | |
# Trying ggjoy. | |
# The world convergence in male life expectancy at birth since 1950 | |
# Ilya Kashnitsky, [email protected] | |
# | |
################################################################################ | |
library(tidyverse) | |
library(forcats) | |
library(wpp2015) | |
library(ggjoy) | |
library(viridis) | |
library(extrafont) | |
data(UNlocations) | |
countries <- UNlocations %>% | |
filter(location_type == 4) %>% | |
transmute(name = name %>% paste()) %>% | |
as_vector() | |
data(e0M) | |
e0M %>% | |
filter(country %in% countries) %>% | |
select(-last.observed) %>% | |
gather(period, value, 3:15) %>% | |
ggplot(aes(x = value, y = period %>% fct_rev()))+ | |
geom_joy(aes(fill = period))+ | |
scale_fill_viridis(discrete = T, option = "B", direction = -1, | |
begin = .1, end = .9)+ | |
labs(x = "Male life expectancy at birth", | |
y = "Period", | |
title = "The world convergence in male life expectancy at birth since 1950", | |
subtitle = "Data: UNPD World Population Prospects 2015 Revision", | |
caption = "ikashnitsky.github.io")+ | |
theme_minimal(base_family = "Roboto Condensed", base_size = 15)+ | |
theme(legend.position = "none") |
I got a similar error as PCK1992. I resolved it by re-installing ggjoy package. It had been working fine for me the other day and this was what fixed it. Could have also been the restart of RStudio too.
emilelatour that worked for me, too!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's very interesting work. I've done something like this by mining Wikipedia data. I wonder would the results be close?