---
title: "Indicadores socieconómicos"
output:
flexdashboard::flex_dashboard:
orientation: row
vertical_layout: fill
source: embed
social: menu
theme: journal
---
```{r setup, include=FALSE}
library(flexdashboard)
library(ggplot2)
library(readxl)
library(tseries)
library(ggfortify)
knitr::opts_knit$set(root.dir = "E:/RMARKDOWN")
```
side_bar {.sidebar}
=======================
Para la elaboración de los indicadores socioeconómicos se ha utilizado los datos del [**INEI**](https://www.inei.gob.pe/){target="_blank"}
# Indicadores educativos {data-icon="fa-book-open"}
##
### Gasto destinado al sector educación
```{r,fig.align='center'}
educacion = read_excel("gasto_educa.xlsx", range = "A6:D32",col_names =TRUE )
ggplot(educacion, aes(x = Total, y = Año)) +
geom_point(color = 3,lwd = 4) +
ggtitle("Gasto del gobierno central 1994-2019",subtitle = "Millones de soles")
```
### Tasa de analfabetismo
```{r analfabetismo,fig.align='center'}
analfabetismo = read_excel("analfabetismo.xlsx", range = "A7:N33",col_names =TRUE )
ggplot(analfabetismo, aes(`2020`, regiones)) +
geom_bar(stat = "identity", fill = "steelblue") +
geom_text(aes(label = round(`2020`,2)), vjust = -0.3, size = 3.5) +
theme_minimal()+ggtitle("Tasa de analfabetismo",subtitle = "Año 2020")
```
##
### Nivel de educación alcanzado
```{r}
nivel_alc= read_excel("nivel.xlsx", range = "A5:N10",col_names =TRUE )
#
ggplot(nivel_alc,aes(x="",y=`2020`, fill=Nive_alcanzado))+
geom_bar(stat = "identity",
color="white")+
geom_text(aes(label=paste(round(`2020`,2),"%")),
position=position_stack(vjust=0.5),color="white",size=6)+
coord_polar(theta = "y")+
scale_fill_manual(values=c("Blue","Red","black","orange","Brown"))+
theme_void()+
ggtitle("Nivel alcanzado de la poblacion",subtitle = "Año 2020")
```
# Indicadores laborales {data-icon="fa-briefcase"}
##
### Poblacion economicamente activa ocupada
```{r,fig.align='center'}
PeaOcupada= read_excel("peao.xlsx", range = "A4:C18",col_names =TRUE )
serie_mujeres <- ts(PeaOcupada$Mujer, start = c(2007,1), end = c(2020,1), frequency = 1)
serie_hombres <- ts(PeaOcupada$Hombre, start = c(2007,1), end = c(2020,1), frequency = 1)
serie_myh <- cbind(serie_mujeres,serie_hombres)
ggplot2::autoplot(serie_myh, facets=TRUE) +
ggtitle("PEA ocupada mujeres vs. hombres",subtitle = "Periodo 2007-2020")+
xlab("años") + ylab("Poblacion en miles")
```
##
### Ingreso promedio mensual
```{r,fig.align='center'}
ing_prom= read_excel("ingreso.xlsx", range = "A4:C14",col_names =TRUE )
ing_prom$Año=as.factor(ing_prom$Año)
ggplot (ing_prom, aes (fill = Año, y = Ingreso_promedio_mensual,x=Rama_actividad)) +
geom_bar (stat = "identity",color="black")+
geom_text(aes(label=round(Ingreso_promedio_mensual)),check_overlap = F)+
labs(title='ingreso promedio mensual por actividad',
subtitle='Año 2019 vs 2020',
caption='Otros 1/:Agricultura, Pesca y Minería',
x='Actividad económica', y='Ingreso mensual')
```
### Desempleo por nivel educativo
```{r}
desempleo= read_excel("desempleo.xlsx", range = "A4:O8",col_names =TRUE )
ggplot(desempleo,aes(x="",y=`2020`, fill=Nivel_educativo))+
geom_bar(stat = "identity",
color="white")+
geom_text(aes(label=paste(round(`2020`,2),"%")),
position=position_stack(vjust=0.5),color="white",size=6)+
coord_polar(theta = "y")+
scale_fill_manual(values=c("Blue","Red","black","Green"))+
theme_void()+
labs(title='Tasa de Desempleo por nivel educativo',
subtitle='Año 2020',
caption='Primaria 1/: Incluye sin nivel e inicial')
```
# Indicadores de pobreza {data-icon="fa-universal-access"}
##
### Poblacion con al menos 1 NBI
```{r pobreza,fig.align='center'}
al_menos1NBI = read_excel("NBI.xlsx", range = "A4:L31",col_names =TRUE )
ggplot(al_menos1NBI, aes(`2020`, Departamento)) +
geom_bar(stat = "identity", fill = "Green",) +
geom_text(aes(label = paste(round(`2020`,2), "%"))) +
theme_minimal()+
labs(title='Población con al menos 1 Necesidad Básica Insatisfecha',
subtitle='Año 2020',
caption="Lima Metropolitana 1/ comprende los 43 distritos
Lima /2 comprende las provincias de : Barranca, Cajatambo, Canta, Cañete, Huaral, Huarochirí, Huaura, Oyón y Yauyos")
```
### Pobreza monetaria
```{r}
pobreza= read_excel("pobre_monetaria.xlsx", range = "A5:L11",col_names =TRUE )
ggplot(pobreza, aes( Dominio,`2020`)) +
geom_bar(stat = "identity", fill = "Red") +
geom_text(aes(label = paste(round(`2020`,2), "%")), vjust = -0.3, size = 3.5) +
theme_minimal()+labs(title="Pobreza monetaria por Dominio Geográfico",
subtitle="Año 2020",x="Dominio", y="% de la población")
```