Skip to content

Instantly share code, notes, and snippets.

Avatar

Ilya Kashnitsky ikashnitsky

View GitHub Profile
@ikashnitsky
ikashnitsky / moscow-votes.R
Created Sep 21, 2021
Visualize the results of Russian parliament voting 2021 in the 15 voting districts of Moscow
View moscow-votes.R
#===============================================================================
# 2021-09-21 -- Moscow elections
# Clean data and visualize ternary compositions
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
library(tidyverse)
library(magrittr)
library(ggdark)
library(hrbrthemes)
@ikashnitsky
ikashnitsky / the-rank.R
Last active Sep 22, 2021
THE 2022 Citaions component
View the-rank.R
#===============================================================================
# 2021-09-17 -- THE ranking
# Citations component of the ranking
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
library(tidyverse)
library(magrittr)
library(countrycode)
library(sf)
View rr21-talk-links.md
@ikashnitsky
ikashnitsky / euro-2020-challenge.R
Last active Jun 23, 2021
Rostock Retreat Viz Uncertainty -- a small challenge
View euro-2020-challenge.R
#===============================================================================
# 2021-06-23 -- Rosrock Retreat
# Dataviz challenge -- EURO 2020 data
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com
#===============================================================================
# Dataset is a detailed team squads data from Transfermarkt
# https://www.transfermarkt.com/euro-2020/teilnehmer/pokalwettbewerb/EM20
# For each country it looks like this
# https://www.transfermarkt.com/england/startseite/verein/3299
View smoothed-dots.R
#===============================================================================
# 2021-06-23 -- Rostock Retreat
# Replicate Fig A1a from https://doi.org/10.1073/pnas.2010588118
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
# Zarulli V, Kashnitsky I, Vaupel JW. 2021. Death rates at specific life stages mold the sex gap in life expectancy. Proceedings of the National Academy of Sciences 118 DOI: 10.1073/pnas.2010588118
library(tidyverse)
@ikashnitsky
ikashnitsky / euro2020-predictions.R
Last active Jun 12, 2021
Win predictions of #EURO2020 pooled together from 18 sources -- https://twitter.com/ikashnitsky/status/1403470245407477764
View euro2020-predictions.R
#===============================================================================
# 2021-06-11 -- twitter
# UEFA European Cup predictions
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
library(tidyverse)
library(magrittr)
library(ggdark)
library(paletteer)
View royal-longevity.R
#===============================================================================
# 2021-04-19 -- critique
# Re-analysis of Royal family members longevity
# https://theconversation.com/amp/long-live-the-monarchy-british-royals-tend-to-survive-a-full-three-decades-longer-than-their-subjects-158766
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
library(tidyverse)
library(magrittr)
library(lubridate)
View rotater-the-damn-plot
library(tidyverse)
mtcars %>%
group_by(cyl = cyl %>% as_factor) %>%
summarise(avg_mpg = mpg %>% mean) %>%
ggplot(aes(avg_mpg, cyl))+
geom_col()
@ikashnitsky
ikashnitsky / dark-tern-theme.r
Last active Apr 1, 2021
a nice dark theme for {ggtern} and {tricolore}
View dark-tern-theme.r
library(ggtern)
library(ggdark)
library(hrbrthemes)
# own options for ternary theme
own_tern_theme <- dark_theme_minimal(base_family = font_rc) +
theme(
legend.position = "none",
axis.title = element_blank(),
tern.axis.arrow.show = FALSE,
@ikashnitsky
ikashnitsky / fun-localize-path.R
Last active Mar 3, 2021
a small function to localize paths in R
View fun-localize-path.R
lp <- function(path) {
require(here)
require(magrittr)
require(glue)
wd <- here::here()
glue(paste0("{wd}/", path))
}