-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindicadores.Rmd
275 lines (224 loc) · 9.47 KB
/
indicadores.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
---
title: "indicadores"
author: "Andrea Gomez Vargas"
date: "`r Sys.Date()`"
output:
html_document:
theme: flatly
toc: yes
toc_float:
collapsed: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(openxlsx)
```
```{r echo=FALSE, message=FALSE, warning=FALSE}
# EPH
pobreza <- read.xlsx("data/datos.xlsx", sheet = "pobreza")
estrato <- read.xlsx("data/datos.xlsx", sheet = "estrato")
ingresos <- read.xlsx("data/datos.xlsx", sheet = "ingresos")
# CAPITAL HUMANO
bess <- read.xlsx("data/datos.xlsx", sheet = "bess-1")
# CENSO
salud <- read.xlsx("data/datos.xlsx", sheet = "salud")
jubilacion <- read.xlsx("data/datos.xlsx", sheet = "jubilacion")
salud2 <- read.xlsx("data/datos.xlsx", sheet = "salud2")
```
## Censo
### Jubilación
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.width= 10, fig.height= 5}
jubilacion <- jubilacion %>%
mutate(sexo = factor(sexo, levels = c("total", "mujeres", "varones")),
cobertura = case_when(
sexo == "total" ~ "Población en edad de jubilarse",
sexo == "mujeres" ~ "Mujeres de 60 años y más",
sexo == "varones" ~ "Varones de 65 años y más"),
cobertura = fct_relevel(cobertura, c("Población en edad de jubilarse",
"Mujeres de 60 años y más",
"Varones de 65 años y más")))
ggplot(jubilacion, aes(cobertura, porcentaje, fill = sexo)) +
geom_col(width = 0.5) +
ylim(c(0,100)) +
#scale_fill_manual(values = c("#fb8b24","#d90368","#820263")) +
scale_fill_manual(values = c("#001524","#3c6e71","#15616d")) +
theme_bw() +
theme(
legend.position = "none"
) +
geom_text(aes(label = porcentaje),
position = position_stack(vjust = 0.9),
size = 4, colour = "white") +
labs(
x = " ",
y = "Porcentaje",
title = "Población en viviendas particulares en edad jubilatoria que percibe jubilación o pensión. \nTotal del país. Año 2022",
caption = "Fuente: elaboración propia con base en datos del INDEC. Censo Nacional de Población, Hogares y Viviendas 2022."
)
```
## Salud
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.width= 10, fig.height= 5}
salud2 <- salud2 %>%
mutate(pp_obra_social = round(obra_social/poblacion_total*100,2),
pp_plan_estatal = round(plan_estatal/poblacion_total*100,2),
pp_no_tiene = round(no_tiene/poblacion_total*100,2)
) %>%
filter(grupo_edad == "total") %>%
select(1, 7:9) %>%
pivot_longer(cols = c(2:4),names_to = "tipo", values_to = "value") %>%
mutate(tipo = case_when( tipo == "pp_no_tiene" ~
"No tiene obra social, prepaga ni plan estatal",
tipo == "pp_plan_estatal" ~ "Programas o planes estatales de salud",
tipo == "pp_obra_social" ~ "Obra social o prepaga (incluye PAMI)")
)
ggplot(salud2, aes(sexo,value, fill = tipo)) +
geom_col() +
coord_flip() +
#scale_fill_viridis_d(option = "a") +
#scale_fill_manual(values = c("#5e548e","#297373", "#389e9e"))+
scale_fill_manual(values = c("#f7b801","#7678ed", "#3d348b"))+
theme_bw() +
labs(
title = "Población en viviendas particulares en edad jubilatoria por sexo registrado al nacer según tenencia de cobertura de salud. \nTotal del pais. Año 2022",
y = "porcentaje",
caption = "Fuente: elaboración propia con base en datos del INDEC. Censo Nacional de Población, Hogares y Viviendas 2022.",
x = " "
) +
geom_text(aes(label = value),
position = position_stack(vjust = .5),size = 4, colour = "black") +
theme(legend.position = "top")
```
## EPH
### Pobreza
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.width= 10, fig.height= 5}
gpobreza <- pobreza %>%
select(1:2,5:6) %>%
pivot_longer(cols = c(3:4), names_to = "pobreza", values_to = "value") %>%
mutate(periodo = paste0(anio, "-", semestre),
pobreza = ifelse(pobreza == "no_pobres", "No pobre", "Pobre"))
ggplot(gpobreza, aes(periodo, value, fill = pobreza)) +
geom_col() +
scale_fill_manual(values = c("#297373", "#e9d758")) +
theme_bw() +
theme(
legend.position = "top"
) +
coord_flip() +
scale_x_discrete(limits=rev) +
geom_text(aes(label = value, group = pobreza),
position = position_stack(vjust = 0.5),
size = 3, colour = "black") +
labs(
x = "periodo",
y = "porcentaje",
fill = "condición",
title = "Población de 65 años y más según condición de pobreza. Total 31 aglomerados. \nPrimer semestre 2018-segundo semestre 2023",
caption = "Fuente: elaboración propia con base en datos del INDEC. Informes técnicos EPH: Incidencia de la Pobreza y de la Indigencia"
)
```
### Estrato
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.width= 10, fig.height= 5}
estrato <- estrato %>%
filter(Grupo == "Total",
Sexo != "Total") %>%
select(1, 3, 9:11) %>%
pivot_longer(cols = c(3:5), names_to = "tipo", values_to = "porcentaje")
ggplot(estrato, aes(Sexo, porcentaje, fill = tipo)) +
geom_col() +
scale_fill_manual(values = c("#143939","#297373", "#389e9e"))+
facet_grid(~ANO4) +
# theme_light() +
labs(
title = "Distribución de la población de 60 años y más por sexo,\nsegún estrato generacional del hogar. Total nacional urbano. Años 2018-2023",
y = "porcentaje",
caption = "Fuente: elaboración propia con base en datos del INDEC. Encuesta Permanente de Hogares total urbano",
x = " "
) +
geom_text(aes(label = porcentaje, group = Sexo),
position = position_stack(vjust = .5),size = 4, colour = "white") +
theme(legend.position = "top")
```
### Ingresos
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.width= 10, fig.height= 5}
ingresos <- ingresos %>%
filter(CH04 != "Total") %>%
select(1,2, 7:9) %>%
pivot_longer(cols = c(3:5), names_to = "tipo", values_to = "porcentaje") %>%
mutate(tipo =
case_when(tipo == "Ingresos.laborales" ~ "ingresos laborales",
tipo == "Jubilación.o.pensión" ~ "jubilación o pensión",
tipo == "Otros.ingresos.no.laborales" ~ "otros ingresos no laborales")) %>%
rename(ano = "Año", sexo = CH04)
ggplot(ingresos, aes(ano, porcentaje, group = tipo, colour = tipo)) +
geom_point(size = 3) +
geom_line(linetype = 2,linewidth = 1) +
facet_wrap(~sexo) +
ylim(c(0,100)) +
scale_color_manual(values = c("#143939","#297373", "#389e9e"))+
# facet_grid(ano ~ tipo) +
theme_bw() +
labs(
title = "Porcentaje de población en edad jubilatoria perceptora de ingresos por tipo de ingreso. Total nacional urbano. Años 2018-2023",
y = "porcentaje",
caption = "Fuente: elaboración propia con base en datos del INDEC. Encuesta Permanente de Hogares total urbano",
x = " "
) +
geom_text(aes(label = porcentaje, group = tipo),vjust = -1) +
# geom_text(aes(label = porcentaje, group = tipo),
# position = position_stack(vjust = 1),size = 3, colour = "black") +
theme(legend.position = "top")
```
## Capital Humano
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.width= 10, fig.height= 5}
gbess <- bess %>%
filter(ano %in% c(2018:2023)) %>%
mutate(pp_con_v = round(con_moratoria_v/total_v*100,2),
pp_sin_v = round(sin_moratoria_v/total_v*100,2),
pp_con_m = round(con_moratoria_m/total_m*100,2),
pp_sin_m = round(sin_moratoria_m/total_m*100,2)
) %>%
select(1, 8:11) %>%
pivot_longer(cols = c(2:5),names_to = "porcentaje", values_to = "value") %>%
mutate(sexo = case_when(porcentaje %in% c("pp_con_m","pp_sin_m") ~ "mujeres",
TRUE ~ "varones"),
jubilacion = case_when(porcentaje %in% c("pp_con_m","pp_con_v") ~ "con moratoria",
TRUE ~ "sin moratoria")
)
ggplot(gbess, aes(sexo, value, fill = jubilacion))+
geom_col() +
facet_wrap(~ ano, nrow = 1) +
#coord_flip() +
#scale_fill_brewer(palette = "Set2") +
scale_fill_manual(values = c("#297373", "#e9d758")) +
theme_bw() +
theme(
legend.position = "top"
) +
geom_text(aes(label = value, group = jubilacion),
position = position_stack(vjust = 0.5),
size = 3, colour = "black") +
labs(
x = " ",
y = "porcentaje",
fill = "percepción jubilatoria",
title = "Distribución porcentual de las jubilaciones del sistema integrado previsional, por sexo y adhesión a moratoria. Total del país. Años 2018-2013",
caption = "Fuente: elaboración propia con base en datos del Ministerio de Capital Humano - Boletín Estadístico de la Seguridad Social")
```
```{r}
# Datos para el gráfico
data <- data.frame(
category = c("Ciclo Vital \nindividual y \nfamiliar", "Sistemas de \nprotección \nsocial", "Biografías \ngeneracionales", "Biografías \npersonales"),
value = rep(1, 4) # Para dividir en partes iguales
)
ggplot(data, aes(x = 2, y = value, fill = category)) +
geom_bar(stat = "identity", width = 1, color = "white") +
coord_polar(theta = "y") +
xlim(0.5, 2.5) + # Ajuste para hacer la dona
theme_void() + # Quitar ejes y fondo
theme(legend.position = "none") + # Opcional: ocultar leyenda
geom_text(aes(label = category), position = position_stack(vjust = 0.5)) + # Texto dentro de las secciones
#annotate("text", x = 0, y = 0, label = "Seguridad Económica", size = 6, fontface = "bold") + # Texto en el centro
scale_fill_brewer(palette = "PRGn") + # Colores opcionales
theme(plot.background = element_rect(fill = "#145357"))
```