Skip to content

Instantly share code, notes, and snippets.

View diegovalle's full-sized avatar

Diego Valle-Jones diegovalle

View GitHub Profile
@diegovalle
diegovalle / ageb0.json
Last active August 29, 2015 14:11
Nobody lives here
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@diegovalle
diegovalle / mx_hexgrid.json
Created May 15, 2015 03:51
Hex Grid of Mexican States
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@diegovalle
diegovalle / election2015.R
Last active August 29, 2015 14:22
2015 Election
library(ggplot2)
library(dplyr)
library(readr)
library(rgeos)
library(maptools)
library(rgdal)
library(scales)
library(downloader)
#Download the latest version of the PREP
@diegovalle
diegovalle / cheaters.r
Last active September 4, 2015 10:34
Corruption indicators and their correlations
########################################################
##### Author: Diego Valle Jones
##### Website: www.diegovalle.net
##### Date Created: Thu Feb 18 19:34:27 2010
########################################################
#Corruption indicators and their correlations
library(ggplot2)
grid.newpage()
@diegovalle
diegovalle / gdp.r
Created February 25, 2010 03:34
Pretty plots of Mexico's gdp
########################################################
##### Author: Diego Valle Jones
##### Website: www.diegovalle.net
##### Date Created: Mon Feb 22 19:11:54 2010
########################################################
#Pretty plots of Mexico's gdp
library(ggplot2)
#deseasonalized quarterly gdp 1993-2009 in 2003 pesos
@diegovalle
diegovalle / juarez-vs-chihuahua.r
Created June 21, 2010 00:40
Compare the SNSP homicide data for Chihuahua
########################################################
##### Author: Diego Valle Jones
##### Website: www.diegovalle.net
##### Date Created: Sun Jun 20 20:30:49 2010
########################################################
#Compare the SNSP homicide data for Chihuahua
library(ggplot2)
#Chihuahua 2008: 1,414 - SNSP data http://www.icesi.org.mx/documentos/estadisticas/estadisticas/denuncias_homicidio_doloso_1997_2008.xls
#Cd. Juarez 2008: 1653 - http://www.google.com/hostednews/afp/article/ALeqM5g2iONUbtwl8in-a_sCMRSmoX8veA
@diegovalle
diegovalle / hispanics-vs-mexicans.r
Created July 9, 2010 20:30
Homicide in Mexico, the US and Canada
########################################################
##### Author: Diego Valle Jones
##### Website: www.diegovalle.net
##### Date Created: Tue Jul 13 11:02:59 2010
########################################################
#1. -Compare homicide rates according Vital Statistics in the US (Hispanics) and in Mexico
#2.- Homicides in the three North American coutries
#Sources:
#INEGI Estadísticas Vitales for Mexico - http://github.com/diegovalle/Homicide-MX-Drug-War
@diegovalle
diegovalle / cisen.r
Created August 4, 2010 20:43
Plot CISEN execution data and compare it to that reported by Milenio
#Plot CISEN execution data and compare it to that reported by Milenio
library(ggplot2)
execu <- read.csv("http://spreadsheets.google.com/pub?key=0AjjLwVYbDGx7dGl3VVRza3JJT3pLQlBqZVNVUGh6SHc&hl=en&single=true&gid=0&output=csv")
mexecu <- melt(execu[3:6], id = c("Year","Month"))
mexecu$date <- as.Date(paste(mexecu$Year, mexecu$Month, "15",
sep = "-"),
format = "%Y-%b-%d")
ggplot(mexecu, aes(date, value, group = variable, color = variable)) +
@diegovalle
diegovalle / narco-killings.R
Created October 14, 2010 01:14
Narco killings map of Mexico
#Download the narco killings map compiled by Walter Mckay available
#at LEAP Mexico https://sites.google.com/site/policereform/leap-mexico/narco-killings
library(rgdal)
library(gtools)
library(maptools)
library(ggplot2)
library(maps)
library(Cairo)
library(stringr)
library(MASS)
@diegovalle
diegovalle / 2009-update.R
Created October 20, 2010 01:10
Chart of the number of homicides in Chihuahua
library(ggplot2)
update <- c(2030, 3156)
original <- c(1414, 2523)
inegi <- c(2567, NA)
hom <- data.frame(year = 2008:2009,
updates = update,
original = original,
inegi = inegi)