Skip to content

Instantly share code, notes, and snippets.

View resulumit's full-sized avatar

Resul Umit resulumit

View GitHub Profile
# r code for the graph at
# https://twitter.com/ResulUmit/status/1341728281251463174?s=20
# load the packages -------------------------------------------------------
library(dataverse)
library(rio)
library(tidyverse)
# specify which installation ----------------------------------------------
# r code for the graph at
# https://twitter.com/ResulUmit/status/1352218275699154945?s=20
# load the packages -------------------------------------------------------
library(dataverse)
library(rio)
library(tidyverse)
# specify which installation ----------------------------------------------
@resulumit
resulumit / rwing_distance.R
Last active December 9, 2022 15:08
The positional distances between right-wing parties and several other party families
# load the data
library(tidyverse)
# write functions to calculate confidence intervals
lower_ci <- function(mean, se, n, conf_level = 0.95){
lower_ci <- mean - qt(1 - ((1 - conf_level) / 2), n - 1) * se
}
upper_ci <- function(mean, se, n, conf_level = 0.95){
upper_ci <- mean + qt(1 - ((1 - conf_level) / 2), n - 1) * se
@resulumit
resulumit / regression_app.R
Last active November 6, 2022 15:38
A app to regress and visualise, using the mtcars dataset
library(dotwhisker)
library(tidyverse)
shinyApp(
ui <- fluidPage(
sidebarLayout(
@resulumit
resulumit / ches_positions.R
Created February 14, 2021 16:08
Evaluation of party positions in the CHES dataset
# load the data
library(tidyverse)
# write functions to calculate confidence intervals
lower_ci <- function(mean, se, n, conf_level = 0.95){
lower_ci <- mean - qt(1 - ((1 - conf_level) / 2), n - 1) * se
}
upper_ci <- function(mean, se, n, conf_level = 0.95){
upper_ci <- mean + qt(1 - ((1 - conf_level) / 2), n - 1) * se
# load the required libraries ---------------------------------------------
library(tidyverse)
# create the dataset of votes ---------------------------------------------
file_ext <- c(1997, 2001, 2005, 2010, 2015, 2017)
temp_list <- list()
# load libraries -------------------------------------------------------
library(tidyverse)
library(rvest)
library(robotstxt)
# get journal names and links from my website -----------------------------
# get names
# a loop-based function in r
# that can be used for multiverse analysis
# with the feols function from the fixest package
feols_multiverse <- function(dep_var, indep_var, cont_var, back_end){
# function to create the powerset
power <- function(x){
sets <- lapply(1:(length(x)), function(i) combn(x, i, simplify = F))
# r code for the animations at
# https://twitter.com/ResulUmit/status/1201779741155635200?s=20
# load libraries ----------------------------------------------------------
library(tidyverse)
library(lubridate)
library(fuzzyjoin)
library(rvest)
library(magrittr)
# packages ----------------------------------------------------------------
library(dataverse)
library(tidyverse)
library(countrycode)
library(maps)
library(ggtext)
library(gganimate)
# note that the following packages must also be installed, but they don't