Skip to content

Instantly share code, notes, and snippets.

Ilya Kashnitsky ikashnitsky

Block or report user

Report or block ikashnitsky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ikashnitsky
ikashnitsky / countries-as-snowflakes.R
Last active Dec 12, 2019
Generate snowfall -- every snowflake scaled to a country population size ^1/3
View countries-as-snowflakes.R
#===============================================================================
# 2019-12-12 -- twitter
# Generate snowfall -- every snowflake scaled to a country population size ^1/3
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com
#===============================================================================
library(tidyverse)
library(magrittr)
library(gganimate)
@ikashnitsky
ikashnitsky / us-names-median-age.R
Last active Dec 9, 2019
Median age of the US living persons with a specific name -- https://twitter.com/ikashnitsky/status/1201770729282424832
View us-names-median-age.R
#===============================================================================
# 2019-12-08 -- digital dem
# Lab 1 -- Popularity of the US names
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com
#===============================================================================
# Data: https://www.ssa.gov/oact/babynames/limits.html
# Post: https://fivethirtyeight.com/features/how-to-tell-someones-age-when-all-you-know-is-her-name
# Gist: https://gist.github.com/ikashnitsky/654965cb971f3a11928806c4d0a0ef23
# Tweet: https://twitter.com/ikashnitsky/status/1201770729282424832
View animated-snowflakes.R
#===============================================================================
# 2019-12-07 -- twitter
# Generate snow and animate it
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com
#===============================================================================
library(tidyverse)
library(magrittr)
library(gganimate)
View pal-safe-five-and-six.R
#===============================================================================
# 2019-11-30 -- gist
# Safe and efficient palette of five colors, print and colorblind friendly
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com
#===============================================================================
library(magrittr)
library(prismatic)
# a function to test color paletes quickly
@ikashnitsky
ikashnitsky / dataviz-rules.R
Last active Nov 8, 2019
Simple rules and tricks to improve dataviz communication | slides: https://ikashnitsky.github.io/share/1911-prc20-dataviz/slides.html#/
View dataviz-rules.R
#===============================================================================
# 2019-11-08 PRC dataviz workshop
# Simple rules and tricks to improve dataviz communication
# slides: https://ikashnitsky.github.io/share/1911-prc20-dataviz/slides.html#/
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com
#===============================================================================
library(tidyverse)
library(magrittr)
View dotplot-plus-manual-legend.R
#===============================================================================
# 2019-07-19-- ikashnitsky.github.io
# Reproduce Figure 2 from http://doi.org/10.1007/s10708-018-9953-5
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com
#===============================================================================
library(tidyverse)
library(hrbrthemes); import_roboto_condensed()
# the data as tribble
@ikashnitsky
ikashnitsky / tidytuesday-190625-ufo.R
Created Jul 12, 2019
Calendar plot of UFO sightings, 2000--2013
View tidytuesday-190625-ufo.R
#===============================================================================
# 2019-07-12 -- tidytuesday
# Data on UFO sightings ,2019-06-25
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com
#===============================================================================
# load required packages
library(tidyverse)
library(janitor)
library(sf)
@ikashnitsky
ikashnitsky / get-all-sjr-data.r
Created Sep 22, 2018
Get all SCImago Journal & Country Rank data (script version of sjrdata package)
View get-all-sjr-data.r
################################################################################
#
# bibliometrics 2018-09-22
# SJR data -- load and combine all files -- GIST
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com
#
################################################################################
library(tidyverse)
library(janitor)
@ikashnitsky
ikashnitsky / rgb-ternary.R
Created Apr 26, 2018
a minimal example of an RGB colorcoded ternary diagram
View rgb-ternary.R
# a function from: Schöley, J., & Willekens, F. (2017). Visualizing compositional data on the Lexis surface. Demographic Research, 36(21), 627–658. https://doi.org/10.4054/DemRes.2017.36.21
TernaryCentroidCoord <- function (k) {
centroids <- matrix(nrow = k^2, ncol = 5,
dimnames = list(NULL, c("j", "i", "p1", "p2", "p3")))
for (j in 1:k) {
for (i in 1:(2*k - 2*j + 1)) {
p1 = (6*k - 6*j - 3*i + 4 + i%%2) / (6*k)
p2 = (6*j - 2 - 2*i%%2) / (6*k)
p3 = (3*i - 2 + i%%2) / (6*k)
centroids[i+(j-1)*(2*k-j+1),] = c(j, i, p1, p2, p3)
@ikashnitsky
ikashnitsky / a-minimal-example.R
Last active Jan 23, 2018
Reproducible example for my SO question on how to fit 2 sf seamlessly -- https://stackoverflow.com/questions/48360446
View a-minimal-example.R
# install dev version of ggplot2
devtools::dev_mode()
devtools::install_github("tidyverse/ggplot2")
library(tidyverse)
library(sf)
library(rmapshaper)
library(ggthemes)
You can’t perform that action at this time.