-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.R
46 lines (34 loc) · 1.27 KB
/
app.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Cargar librerías y datos
library(shiny)
library(sf)
library(dplyr)
library(tidyr)
library(ggplot2)
library(plotly)
# Cargando datos ----------------------------------------------------------
shape <- read_sf(dsn = "data/mapas/Distrital INEI 2023 geogpsperu SuyoPomalia.shp")
sandra <- read.csv(file = "data/sandra_total.csv", fileEncoding = "latin1")
# Transformando datos -----------------------------------------------------
sandra = sandra %>%
gather(Dx_Type, Dx, Dx_PT, Dx_TE, Dx_PE) %>%
group_by(UbigeoPN, Sexo, Dx_Type, Dx) %>%
summarise(count = n()) %>%
ungroup()
names(sandra) = c("UBIGEO", "Sexo","indicador","categorias","Numero")
datos_sum_dx_pe <- sandra %>%
filter(indicador == "Dx_PE") %>%
group_by(UBIGEO, Sexo, categorias) %>%
summarise(Numero = sum(Numero))
datos_sum_dx_pt <- sandra %>%
filter(indicador == "Dx_PT") %>%
group_by(UBIGEO, Sexo, categorias) %>%
summarise(Numero = sum(Numero))
datos_sum_dx_te <- sandra %>%
filter(indicador == "Dx_TE") %>%
group_by(UBIGEO, Sexo, categorias) %>%
summarise(Numero = sum(Numero))
# Cargando server y ui ----------------------------------------------------
source("ui.R")
source("server.R")
# Corriendo app -----------------------------------------------------------
shinyApp(ui = ui, server = server)