Skip to content

Instantly share code, notes, and snippets.

Diego Valle-Jones diegovalle

View GitHub Profile
@diegovalle
diegovalle / cheaters.r
Last active Sep 4, 2015
Corruption indicators and their correlations
View cheaters.r
########################################################
##### 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 Feb 25, 2010
Pretty plots of Mexico's gdp
View gdp.r
########################################################
##### 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 / diet.r
Created Mar 9, 2010
Cluster analysis of what the world eats
View diet.r
########################################################
##### Author: Diego Valle Jones
##### Website: www.diegovalle.net
##### Date Created: Mon Mar 01 18:51:27 2010
########################################################
#1. For what foods are Americans and Mexicans outliers
#2. Partition the data around medoids to classify the
#countries of the world according to what they eat
library(ggplot2)
@diegovalle
diegovalle / juarez-vs-chihuahua.r
Created Jun 21, 2010
Compare the SNSP homicide data for Chihuahua
View juarez-vs-chihuahua.r
########################################################
##### 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 Jul 9, 2010
Homicide in Mexico, the US and Canada
View hispanics-vs-mexicans.r
########################################################
##### 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 Aug 4, 2010
Plot CISEN execution data and compare it to that reported by Milenio
View cisen.r
#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 Oct 14, 2010
Narco killings map of Mexico
View narco-killings.R
#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 Oct 20, 2010
Chart of the number of homicides in Chihuahua
View 2009-update.R
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)
@diegovalle
diegovalle / acteal.R
Created Dec 23, 2010
Problems with the Mexican mortality database
View acteal.R
library(ggplot2)
library(stringr)
ah <- read.csv("http://spreadsheets.google.com/pub?key=0AjjLwVYbDGx7dGNxV0FOd3c4a3hxa2FkTEh5QS0wX2c&hl=en&single=true&gid=0&output=csv")
ah$mon.num <- 1:12
ah$Year <- rep(1997:1998, each = 12)
ah$Date <- as.Date(str_c(ah$Year, ah$mon.num, "15", sep = "-"))
m.ah <- melt(ah[c(2,3,6)], id = c("Date"))
@diegovalle
diegovalle / drug-war-dates.yaml
Created Feb 2, 2011
Important dates in the Mexican drug war (joint ops, captures, etc)
View drug-war-dates.yaml
R.C.Assassination:
Rodolfo Carrillo Fuentes Assassination: 2004-09-11
source: http://www.noroeste.com.mx/publicaciones.php?id=409384
Fox.Troops.NL:
Troops in Nuevo Laredo: 2005-06-13
source: http://www.univision.com/content/content.jhtml?cid=625397
Op.Michoacan:
Operation Michoacan: 2006-12-11
You can’t perform that action at this time.