This code replicates a chart on slide 10 from Sberbank Centre for Macroeconomic Research presentation on Gini index measurements in various surveys in Russia.
library(data.table)
library(reldist)
library(ggplot2)
library(ggthemes)
library(scales)This code replicates a chart on slide 10 from Sberbank Centre for Macroeconomic Research presentation on Gini index measurements in various surveys in Russia.
library(data.table)
library(reldist)
library(ggplot2)
library(ggthemes)
library(scales)| library(data.table) | |
| library(arrow) | |
| ################## | |
| # Load RFSD | |
| RFSD <- open_dataset("local/path/to/RFSD") | |
| scan_builder <- RFSD$NewScan() | |
| scan_builder$Filter(Expression$field_ref("year") >= 2011 & Expression$field_ref("year") <= 2023) | |
| scan_builder$Project(cols = c("inn", "ogrn", "year", "okved_section", "okved", "eligible", "filed", "imputed", "outlier", "line_1150", "line_2110")) | |
| scanner <- scan_builder$Finish() |
| # Install dependencies | |
| #install.packages(c("fftw","tuneR","rgl","rpanel", "seewave"), repos="http://cran.at.r-project.org/") | |
| # for Fast Fourier transform (fftw) to work, install | |
| # the fftw lib (e.g. brew install fftw) | |
| # Load libraries | |
| library(data.table) | |
| library(tuneR) | |
| library(seewave) |
This is a tilegram of Russian regions with area being distorted according to 2015 population. I relied on Gastner and Newman, 2004 distortion algorithm. Each hexagon is approximately equal to 25,000 people. Hover over the regions to see their names and population counts (in Russian).
# (c) Dmitriy Skougarevskiy, November 2016
#
# Use of this source code is governed by the MIT license
# located at https://opensource.org/licenses/MIT
# Load dependencies
packages <- c("maptools", "raster", "sp", "rgeos", "devtools")
# A proof-of-concept code to calculate
# cycling distance between two points in
# central Moscow that incorporates elevation profiles
#
# By Dmitriy Skougarevskiy, 2016-10-30
| # Install dependencies | |
| packages <- c("data.table", "tm", "SnowballC", "Matrix", "textir") | |
| if (length(setdiff(packages, rownames(installed.packages()))) > 0) { | |
| install.packages(setdiff(packages, rownames(installed.packages()))) | |
| } | |
| # Load dependencies | |
| lapply(packages, library, character.only = TRUE) | |
| # Path to data |
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <style> | |
| .tract { | |
| fill: #ccc; | |
| } | |
| .tract:hover { | |
| fill: orange; |
A demonstration of a Stereographic Cylindrical projection of Braun (x=cosφ0×λ; y=(1+cosφ0)×tan(φ/2), where λ is the longitude, φ is the latitude, φ0 is standard parallel) under various φ0.
| * Stata .do file to replicate the analysis in http://kashin.guru/2014/07/01/pride/ based on WVS question on national pride | |
| * ssc inst coefplot | |
| * Data is available at http://www.worldvaluessurvey.org/WVSDocumentationWVL.jsp (file WVS_Longitudinal_1981-2014_stata_dta_v_2014_06_17_Beta) | |
| cd "~/Downloads/" | |
| use WVS_Longitudinal_1981-2014_stata_dta_v_2014_06_17_Beta.dta, clear | |
| * Generate regressors | |
| gen male =. | |
| replace male = 0 if X001 > 0 | |
| replace male = 1 if X001 == 1 |