Skip to content

Instantly share code, notes, and snippets.

Jay Ulfelder ulfelder

Block or report user

Report or block ulfelder

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
View womens_march_attendance_2017.R
# metadata
data_source <- "https://docs.google.com/spreadsheets/d/1xa0iLqYKz8x9Yc_rfhtmSOJQ2EGgeUVjvV4A8LsIaxY/htmlview?sle=true#gid=0"
data_collectors <- "Jeremy Pressman (@djpressman, U of Connecticut) and\nErica Chenoweth (@EricaChenoweth, U of Denver)"
code_gist <- "https://gist.github.com/benmarwick/a1ac9c7235ebef542824512162ff2f44"
# ------------------------------------------------------------------------
# read in data from google sheets to get a data frame
@ulfelder
ulfelder / freedomintheworld.converter
Last active Apr 20, 2016
Converts Freedom House's Freedom in the World data into standard country-year structure for time-series cross-sectional analysis.
View freedomintheworld.converter
# This script converts Freedom House's annual Freedom in the World data from
# the ugly, table-like Excel format in which it's posted into a data frame in R.
# It is set up to work on future updates, too, and should automatically adjust
# as years or countries are added.
#
# Before running this script:
#
# 1. Open a browser & go to http://www.freedomhouse.org/report-types/freedom-world
#
# 2. Download the file "Country ratings and status, FIW 1973-2013(EXCEL)"
@ulfelder
ulfelder / gdelt.atrocities.daily.screen
Created May 30, 2013
R script for a human-assisted process to screen GDELT for atrocities
View gdelt.atrocities.daily.screen
# Clear the workspace
rm(list=ls(all=TRUE))
# Set working directory to location of extracted daily update and .txt file with column headers
# setwd("PUT YOUR DIRECTORY NAME HERE")
# Load function to return subset involving violence against civilians
extractor <- function(date) {
filename <- paste(date,"export.csv", sep=".")
dailies <- read.delim(filename, header=FALSE)
@ulfelder
ulfelder / gdelt.atrocities.explore
Last active May 31, 2016
R code for selecting events from GDELT files that look like they might be atrocities (i.e., lethal violence against civilians), summing them by location, and mapping them.
View gdelt.atrocities.explore
# Housekeeping: clear workspace and load packages
rm(list=ls(all=TRUE))
library(lubridate)
library(RgoogleMaps)
library(ggmap)
library(mapproj)
library(ggplot2)
library(plyr)
# Load 2011 GDELT data from http://eventdata.psu.edu/data.dir/GDELT.html
You can’t perform that action at this time.