-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmuertes_cdmx.Rmd
110 lines (85 loc) · 4.18 KB
/
muertes_cdmx.Rmd
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
title: "Muertes diarias en la CDMX"
author: "Cesar Gerardo Hernández Vargas"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: scroll
fig_mobile: TRUE
theme: lumen
social: ["twitter", "facebook"]
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(plotly)
library(data.table)
muertes <- fread("https://datos.cdmx.gob.mx/explore/dataset/actas-de-defuncion-en-el-registro-civil-de-la-ciudad-de-mexico/download/?format=csv&timezone=America/Mexico_City&lang=es&use_labels_for_header=true&csv_separator=%2C")
muertes$fecha_defuncion<-as.Date(muertes$fecha_defuncion)
siete<-filter(muertes, fecha_defuncion<"2018-01-01")
ocho<-filter(muertes, fecha_defuncion>"2017-12-31", fecha_defuncion<"2019-01-01")
nueve<-filter(muertes, fecha_defuncion>"2018-12-31", fecha_defuncion<"2020-01-01")
veinte<-filter(muertes, fecha_defuncion>"2019-12-31")
```
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-177453627-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-177453627-1');
</script>
Defunciones acumuladas en la CDMX según la fecha de defunción
========================================
Column {data-width=650}
-----------------------------------------------------------------------
### Defunciones en 2020
```{r}
veinte_recuento<-veinte %>% group_by(fecha_defuncion) %>% summarise(n = n())
g20<-ggplot(veinte_recuento) +
aes(x = fecha_defuncion, y = n) +
geom_line(size = 1L, colour = "red") +
theme_minimal()
ggplotly(g20)
```
>Fuente: Elaboración propia con [datos abiertos del Gobierno de la CDMX](https://datos.cdmx.gob.mx/explore/dataset/actas-de-defuncion-en-el-registro-civil-de-la-ciudad-de-mexico/information/).
Column {data-width=350}
-----------------------------------------------------------------------
### Defunciones en2019
```{r}
nueve_recuento<-nueve %>% group_by(fecha_defuncion) %>% summarise(n = n())
g19<-ggplot(nueve_recuento) +
aes(x = fecha_defuncion, y = n) +
geom_line(size = 1L, colour = "orange") +
theme_minimal()
ggplotly(g19)
```
>Fuente: Elaboración propia con [datos abiertos del Gobierno de la CDMX](https://datos.cdmx.gob.mx/explore/dataset/actas-de-defuncion-en-el-registro-civil-de-la-ciudad-de-mexico/information/).
### Defunciones en 2018
```{r}
ocho_recuento<-ocho %>% group_by(fecha_defuncion) %>% summarise(n = n())
g18<-ggplot(ocho_recuento) +
aes(x = fecha_defuncion, y = n) +
geom_line(size = 1L, colour = "purple") +
theme_minimal()
ggplotly(g18)
```
>Fuente: Elaboración propia con [datos abiertos del Gobierno de la CDMX](https://datos.cdmx.gob.mx/explore/dataset/actas-de-defuncion-en-el-registro-civil-de-la-ciudad-de-mexico/information/).
### Defunciones en 2017
```{r}
siete_recuento<-siete %>% group_by(fecha_defuncion) %>% summarise(n = n())
g17<-ggplot(siete_recuento) +
aes(x = fecha_defuncion, y = n) +
geom_line(size = 1L, colour = "#0c4c8a") +
theme_minimal()
ggplotly(g17)
```
>Fuente: Elaboración propia con [datos abiertos del Gobierno de la CDMX](https://datos.cdmx.gob.mx/explore/dataset/actas-de-defuncion-en-el-registro-civil-de-la-ciudad-de-mexico/information/).
Créditos
========================================
###
Created by: [Cesar Hernández](https://cghv94.github.io)
Correo: cghv94@outlook.es
Twitter: @[cghv94](https://twitter.com/cghv94)
Este sitio está vinculado con [Google Analytics](https://analytics.google.com/analytics/web/provision/#/provision) y [Google Search Console](https://search.google.com/search-console/about).
<p>Esta obra fue generada mediante R en `r format(Sys.Date(), format = "%B %d, %Y")`. [Creative Commons (CC)](http://creativecommons.org/licenses/by-nc-sa/4.0/).<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Licencia de Creative Commons" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/80x15.png" /></a><br/><br/>Esta obra está bajo una <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">licencia de Creative Commons Reconocimiento-NoComercial-CompartirIgual 4.0 Internacional.</a></p>