Last active
September 29, 2015 03:07
-
-
Save christophergandrud/1538221 to your computer and use it in GitHub Desktop.
Legislative Violence Map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################## | |
# Map of incidences of legislative violence (1980-2011) | |
# Christopher Gandrud | |
# Updated 6 September 2013 | |
######################## | |
library(foreign) | |
library(googleVis) | |
library(gregmisc) | |
library(plyr) | |
## Load data | |
leg.raw <- read.csv("~/Legislative_Violence.csv") | |
# Get frequency count | |
incidence <- count(leg.raw, c("violence", "Country")) | |
incidence <- subset(incidence, violence == 1) | |
incidence <- incidence[,2:3] | |
# Clean up data | |
incidence$Country <- gsub("Korea South", "South Korea", incidence$Country) | |
incidence <- rename.vars(incidence, from ="freq", to = "Leg Brawl", info = FALSE) | |
# Make Google Map | |
# Color numbers found with colorblender.com | |
violence.map <- gvisGeoMap(incidence, locationvar = "Country", numvar = "Leg Brawl", | |
options = list( | |
colors = "[0xEDDD00, 0xED6700, 0xA04400]" | |
) | |
) | |
plot(violence.map) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment