Skip to content

Instantly share code, notes, and snippets.

View ikashnitsky's full-sized avatar

Ilya Kashnitsky ikashnitsky

View GitHub Profile
@ikashnitsky
ikashnitsky / top-50-demographers.R
Last active January 3, 2024 15:13
Demographic Hall of Fame – authors who published most papers in 10 leading demographic journals
auth_50 %>%
ggplot(aes(avg_cit, n_papers, color = avg_age_of_papers))+
geom_vline(xintercept = 0, size = 2, color = "#04444499")+
geom_point(size = 2)+
geom_text(
aes(label = author_abbr, size = n_papers),
hjust = c(-.1, 1.1) %>% rep(25),
vjust = c(-.05, 1.05) %>% rep(25),
fontface = 2,
alpha = .75
@ikashnitsky
ikashnitsky / convert_pdf_to_png.R
Created December 21, 2023 16:36
R function to convert all PDFs in a directory into PNGs
#===============================================================================
# 2023-12-21 -- misc
# convert pdf to png
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
#' @description A function to convert all PDFs in a directory into PNGs
#' @param dir_pdfs character. A character string with a path to the directory containing PDFs to convert
#' @param output_dir character. An optional parameter to specify the output directory for the converted PNGs. Defaults to `"/png"`, which creates a sub-directory `png` in the specified above `dir_pdfs` directory. Can be any location on the machine, one useful place may be something with all the temporary stuff like `"~/Downloads"`. Important: don't leave trailing slashes in the parameters.
@ikashnitsky
ikashnitsky / asian-restaurants-dk.R
Created November 6, 2023 11:55
Map all OSM restaurant of Denmark and highlight Asian cuisine ones calculate % in regions
#===============================================================================
# 2023-11-06 -- 30DayMapChallenge
# ASIA -- restaurants in Denmark
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky.phd
#===============================================================================
library(tidyverse)
library(magrittr)
library(osmdata)
library(eurostat)
@ikashnitsky
ikashnitsky / example-smd.R
Last active April 28, 2023 12:31
Scholarly Migration Database launch meeting -- examples
#===============================================================================
# 2023-04-12 -- SMD lightning talk
# Usecase of SMD
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
library(tidyverse)
library(magrittr)
library(prismatic)
library(janitor)
@ikashnitsky
ikashnitsky / theme_ik.R
Created January 3, 2023 10:37
theme_ik() – my custom ggplot2 theme that fits the style of my blog – https://ikashnitsky.github.io/2022/exceptional-world-cup
#===============================================================================
# 2023-01-03 -- ik-q
# My custom ggplot2 theme
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
library(ggplot2)
theme_ik <- function(
base_size = 12,
@ikashnitsky
ikashnitsky / world-cup-odds.R
Last active December 26, 2022 07:37
Were there too many unlikely results in Qatar? -- https://ikashnitsky.github.io/2022/exceptional-world-cup
#===============================================================================
# 2022-12-25 -- ik-q
# World cups -- was Qatar that exceptional?
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
library(tidyverse)
library(magrittr)
library(wdman)
library(RSelenium)
age f m
0 -5.1434 -4.9376
1 -6.9847 -6.7604
2 -8.1263 -7.8737
3 -8.296 -7.9834
4 -8.475 -8.1497
5 -8.6084 -8.2851
6 -8.7217 -8.3666
7 -8.8148 -8.4156
8 -8.8967 -8.464
@ikashnitsky
ikashnitsky / odds-world-cups.R
Created December 4, 2022 21:06
(comparison with previous years) Were there too many sensations at FIFA World Cup in Qatar?
#===============================================================================
# 2022-12-04 -- misc
# get oddsportal data
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
library(tidyverse)
library(magrittr)
library(ggrepel)
library(sysfonts)
@ikashnitsky
ikashnitsky / odds-qatar.R
Last active December 3, 2022 12:50
Were there too many sensations in Qatar? What if I bet the same amount against the odds in all the group-stage games?
#===============================================================================
# 2022-12-03 -- misc
# World Cup games odds
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
library(tidyverse)
library(magrittr)
library(rvest)
library(ggrepel)
@ikashnitsky
ikashnitsky / fedified.R
Last active November 19, 2022 21:49
Explore the twitter accounts included in fedified.com -- https://fosstodon.org/@ikashnitsky/109372644538546176
#===============================================================================
# 2022-11-19 -- exploration
# Explore the list from fedified dot com
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
options(scipen = 999)
library(tidyverse)
library(magrittr)
library(rvest)