Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Problems with the Mexican mortality database

View acteal.R
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
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"))
 
ggplot(m.ah, aes(Date, value, group = variable,
color = variable)) +
geom_line(size = 1.2) +
xlab("date") +
ylab("number of deaths") +
opts(title = "Deaths by Homicide or Accident in the Municipality of Chenalh├│ (1997-1998)") +
scale_colour_hue("type of\ndeath") +
annotate("text", x=as.Date("1997-12-23"), y = 46,
label = "The acteal massacre occurred\non December 22, 1997", hjust = 0)
dev.print(png, "acteal.png", width = 700, height = 500)
 
juarez <- read.csv("http://spreadsheets.google.com/pub?key=0AjjLwVYbDGx7dFdXbHFnS1lqM1drUE84NGtmeTBxQVE&hl=en&single=true&gid=0&output=csv")
juarez$per <- juarez$Lesions / juarez$Total
ggplot(subset(juarez, Year >= 1994), aes(Year, per)) +
geom_line(size = 1.2) +
scale_y_continuous(formatter = "percent") +
opts(title = "Fatal Lesions of Unknown Intent as a Percentage of Homicides") +
ylab("percentage") + xlab("year")
dev.print(png, "juarez-lesions.png", width = 700, height = 500)

Estimado Diego
Esta muy interesante la sintaxis, una consulta ┬┐haz corregido las base de datos de mortalidad tomando en cuenta las reglas de CIE 10?
Mi pregunta va porque actualmente me encuentro estableciendo consistencia en la base de datos de mortalidad o sea aplicando las regla de modficacion de mortalidad. La experiencia que haz adquirido me va ser de utilidad para avanzar con mis labores. mi correo es lupe.vidal7@gmail.com
Muy agradecido por tu respuesta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.