View mx_geofacet.R
library(dplyr)
library(readr)
library(ggplot2)
library(geofacet)
read_csv("https://elcri.men/data/victimas.csv.gz") %>%
filter(modalidad == "HOMICIDIOS" & tipo == "DOLOSOS") %>%
mutate(date = as.Date(paste0(date, "-01"))) %>%
mutate(rate = count / population * 10^5 * 12) %>%
View mx_grid.R
library(dplyr)
library(stringr)
library(readr)
library(ggplot2)
library(geofacet)
options(stringsAsFactors = FALSE)
mx_grid <- data.frame(
code = c(2L, 8L, 26L, 3L, 5L, 10L, 19L, 25L, 28L, 1L, 18L, 24L, 32L,
11L, 13L, 14L, 22L, 30L, 6L, 15L, 29L, 9L, 17L, 21L, 31L, 4L,
View carto_electoral.sh
#!/bin/bash
# Author: Diego Valle-Jones
# Web: http://www.diegovalle.net
# Purpose: Script to download electoral shapefiles
# from http://cartografia.ife.org.mx/sige7/?distritacion=federal
# Every six months or so the INE updates the shapefiles
# be sure to update this variable
DATE="mar2017"
View secciones_edomex.sh
#!/bin/bash
#From http://dorganizacion.ieem.org.mx/SIGE/#
mkdir kml
for i in {1..45}
do
curl -Lo kml/seccion_$i.kml "https://www.google.com/fusiontables/exporttable?query=select+col27+from+1DDGrYAoLQ6dTDRz0sUDP3RLxIk8AfI45syz7kxrT+where+col12+%3D+$i&o=kml&g=col27&styleId=2&templateId=2"
done
View leaflet_municipios.R
library("dplyr")
library("mxmaps")
library("geojsonio")
library("jsonlite")
library("leaflet")
# Convert the topoJSON to spatial object
tmpdir <- tempdir()
# have to use RJSONIO or else the topojson isn't valid
write(RJSONIO::toJSON(mxmunicipio.topoJSON), file.path(tmpdir, "mun.topojson"))
View download.sh
#!/bin/bash
set -e
# Download electoral shapefiles from the INE
# includes colonias
# needs sudo apt-get install p7zip-rar p7zip-all
# Download the maps
# State abbreviations
declare -a states=("ags" "bc" "bcs" "camp" "coah" "col" "chis" "chih"
"df" "dgo" "gto" "gro" "hgo" "jal" "mex" "mich" "mor" "nay" "nl" "oax"
View mxstates.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View shp_encuesta_intercensal_2015.sh
#! /bin/bash
# Author: Diego Valle-Jones
# Web: https://www.diegovalle.net
# LICENSE: Apache 2.0
# Purpose: Download shapefiles of manzanas (blocks), agebs (census areas), ejes
# viales (streets), interesting areas and a whole bunch of other stuff from
# the Encuesta Intercensal 2015
# As of now, this script has not been tested on Windows,
View download15.sh
#! /bin/bash
# Author: Diego Valle-Jones
# Web: http://www.diegovalle.net
# Purpose: Download shapefiles of manzanas (blocks), agebs (census areas), ejes
# viales (streets), interesting areas and a whole bunch of other stuff from
# the Encuesta Intercensal 2015
# As of now, this script has not been tested on Windows and Mac
# systems, only on Ubuntu. The script will create a directory
View privacy_policy_blogdiegovallenet.md

Privacy Policy

Last revised on 2015-08-16

The Gist

diegovalle.net will collect certain non-personally identify information about you as you use our sites. We may use this data to better understand our users. We can also publish this data, but the data will be about a large group of users, not individuals.

We will also ask you to provide personal information, but you'll always be able to opt out. If you give us personal information, we won't do anything evil with it.