Skip to content

Instantly share code, notes, and snippets.

View memoryfull's full-sized avatar

Dmitriy Skougarevskiy memoryfull

  • European University at St. Petersburg
  • St. Petersburg
  • X @memoryfull
View GitHub Profile
@memoryfull
memoryfull / syomin_2025_replication_code.R
Created June 17, 2025 09:50
This code seeks to replicate Syomin (2025) in-text statement: "For a validation, a list of law firms’ unique tax IDs obtained from the SME registry for the year 2023 is matched with the list of law firms’ tax IDs from the Russian Financial Statements Database (RFSD) [31] for the same year. The comparison shows that ~3,300 of the firms present in…
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()
@memoryfull
memoryfull / amplitude_time_density_example.R
Created February 23, 2017 17:49
An example of seewave::acoustat amplitude density calculation
# 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)
@memoryfull
memoryfull / README.md
Created November 8, 2016 21:56
Tilegram of Russian regions

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")
@memoryfull
memoryfull / README.md
Last active October 31, 2016 13:53
Optimal cycling path in Moscow

SRTM 1 second arc elevation data and optimal cycling path from the Cathedral of Christ the Saviour to the Pushkin Square in Moscow

# 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
@memoryfull
memoryfull / categorizing_keywords.r
Last active October 14, 2015 16:25
Web search keyword classifier for clearspending.ru
# 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
@memoryfull
memoryfull / index.html
Created October 14, 2015 10:35
(Unsuccessfully) filtering Bronx from ny.json
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.tract {
fill: #ccc;
}
.tract:hover {
fill: orange;
@memoryfull
memoryfull / README.md
Created October 11, 2015 21:37
Affine transformation in d3.geo()

A demonstration of an Affine transformation in d3.geo().

For reference: an Affine transformation with same parameters in QGIS text

@memoryfull
memoryfull / README.md
Last active August 28, 2015 01:12
Stereographic Cylindrical projections of interest

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.

setwd("~/Downloads/")
library("foreign")
library("lme4")
library("lattice")
library("sandwich")
library("arm")
library("car")
library("lmtest")
# Load data
* 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