View mx_hexgrid.json
Octocat spinner 128
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
View homicides-2013.Rmd
1 2 3 4 5 6 7 8 9 10
---
title: "Changes in homicide rates"
output: html_document
---
 
I've updated the [mxmortalitydb](https://github.com/diegovalle/mxmortalitydb) package to include 2013 data. This data only packages includes all injury intent deaths (accidents, homicides, suicides and unspcified intent) that were registered in Mexico from 2004 to 2013. You can use the package to calculate changes and trends in homicide rates in the most violent metro areas or big municipios.
```{r}
#if (!require('devtools')) install.packages('devtools')
View ageb0.json
Octocat spinner 128
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
View privacy_policy.markdown

Privacy Policy

Last revised on [DATE]

The Gist

[COMPANY] 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.

View json_to_csv.R
1 2 3 4 5 6 7 8 9 10
library("jsonlite")
library("dplyr")
library("magrittr")
library("stringr")
 
rnpe_c <- fromJSON('rnped_comun.json')
rnpe_c <- as.data.frame(rnpe_c$aaData, stringsAsFactors = FALSE)
rnpe_c$date <- as.Date(rnpe_c$fuerocomun_desapfecha, "%d/%m/%Y")
rnpe_c$tipo <- "comun"
rnpe_c$fuerocomun_desapentidad %<>% str_replace_all(" DE ZARAGOZA|ESTADO DE ", "")
View gist:8c8ce89af5efec8d14f6
1 2 3 4 5 6 7 8 9 10
--cuadrantes
with crimes as
(select sum(count) as count,sector,cuadrante,max(population)as population, crime from cuadrantes where date >= '2013-08-01' and date <= '2014-07-01' group by cuadrante, sector, crime)
SELECT * from (SELECT count,crime,sector,cuadrante,rank() over (partition by crime order by count desc) as rank,population from crimes group by count,crime,sector,cuadrante,population) as temp2 where rank <= (SELECT rank from (SELECT count,cuadrante,rank() over (partition by crime order by count desc) as rank, row_number() OVER (ORDER BY count desc) AS rownum from crimes) as rank10 where rownum = 10) order by crime, rank,sector, cuadrante
 
 
--sectores
with crimes as
(select (sum(count) / (sum(population) /12 )* 100000) as rate,sum(count) as count,sector,sum(population)/12 as population, crime from cuadrantes where date >= '2013-08-01' and date <= '2014-07-01' group by sector, crime)
SELECT * from (SELECT count,rate,crime,sector,rank() over (partition by crime order by rate desc) as rank,population f
View gist:0cf879df4e57359177f1
1
Verifying that +diegovalle is my Bitcoin username. You can send me #bitcoin here: https://onename.io/diegovalle
View largefam.R
1 2 3 4 5 6 7 8 9 10
require(ggplot2)
require(reshape)
require(stringr)
require(scales)
library(directlabels)
hom <- read.table(text="2010 2000 state
0.589481859 0.7044360966 Total
0.4050632911 0.4418604651 Aguascalientes
0.5746496039 0.6178509532 Baja California
View conyugal.R
1 2 3 4 5 6 7 8 9 10
require(ggplot2)
require(reshape)
require(stringr)
require(scales)
hom <- read.table(text="Sin escolaridad Educación básica Educación media superior Educación superior Estudios técnicos o comerciales con preparatoria terminada Normal de licenciatura Profesional Maestría Doctorado
0.1333900264 0.0866986092 0.1203814875 0.1677704297 0.1350452061 0.1673361018 0.1723742877 0.2003161063 0.2381625442
0.4782996145 0.6043175271 0.6266342786 0.6165165611 0.6309864938 0.6017564164 0.6192202588 0.5912486197 0.5414840989
0.2509738821 0.1739237235 0.1075405894 0.076660514 0.0937652362 0.0858057049 0.0711621725 0.0664256176 0.0792932862
0.0728234689 0.082743796 0.0742778733 0.0565067911 0.067043598 0.0648512492 0.0533251335 0.0454456882 0.0493286219
View estudios.R
1 2 3 4 5 6 7 8 9 10
require(ggplot2)
require(reshape)
require(stringr)
hom <- read.table(text="Sin escolaridad Educación básica Educación media superior Educación superior Estudios técnicos o comerciales con preparatoria terminada Normal de licenciatura Profesional Maestría Doctorado
4.3590760723 3.271073644 2.2923336285 1.8956866673 2.1159363265 1.9962284703 1.8477515858 1.655703986 1.5113780919
", sep = "\t", row.names = NULL, header=TRUE,
colClasses = "numeric")
names(hom)[1] <- "Sin.escolaridad"
Something went wrong with that request. Please try again.