output:
flexdashboard::flex_dashboard: orientation: columns vertical_layout:
fill runtime: shiny ---
form1$casusa <- if_else(form1$Tipo.de.emergencia == "Natural", form1$Causa.del.ATE, form1$Causa.del.ATE.1)
form1$n <-1
x<- form1 %>%
select(Tipo.de.emergencia, casusa, n) %>%
group_by(Tipo.de.emergencia, casusa) %>%
summarise(n = sum(n)) %>%
filter(casusa != "")
## `summarise()` has grouped output by 'Tipo.de.emergencia'. You can override
## using the `.groups` argument.
ggplot(x, aes(area = n, fill = Tipo.de.emergencia, label = casusa)) +
geom_treemap() +
geom_treemap_text()
form1 %>%
tabyl(Tipo.de.ATE) %>%
adorn_pct_formatting() %>%
filter(Tipo.de.ATE != "") %>%
ggplot(aes(x = "", y = n, fill = Tipo.de.ATE)) +
geom_col() +
geom_label(aes(label = percent),
position = position_stack(vjust = 0.5),
show.legend = FALSE) +
coord_polar(theta = "y")+
guides(fill = guide_legend(title = "Tipo de ATE")) +
scale_fill_viridis_d() +
coord_polar(theta = "y") +
theme_void()
## Coordinate system already present. Adding new coordinate system, which will
## replace the existing one.
y1 <- form1 %>%
select(data_date, Department, n) %>%
group_by(data_date, Department) %>%
summarise(n = sum(n))
## `summarise()` has grouped output by 'data_date'. You can override using the
## `.groups` argument.
ggplotly(
ggplot(y1, aes(x = as.Date(data_date), y = n, fill = Department)) +
geom_stream(type = "ridge")+
theme(axis.text.x = element_text(angle = 90))
)
form2$n <- 1
continuidad <- as.data.frame(c("Permanente", "Semanal", "No existe"))
colnames(continuidad)<- "Continuidad"
per <- as.data.frame(table(str_detect(form2$Continuidad.de.flujo.de.agua, "Permanen")))
sem <- as.data.frame(table(str_detect(form2$Continuidad.de.flujo.de.agua, "Seman")))
no <- as.data.frame(table(str_detect(form2$Continuidad.de.flujo.de.agua, "No")))
continuidad$Numero<- 0
continuidad[2,2]<- sem[2,2]
continuidad[1,2]<- per[2,2]
continuidad[3,2]<- no[2,2]
continuidad$porcentaje <- (continuidad$Numero * 100)/sum(continuidad$Numero)
ggplot(continuidad) +
aes(x = Continuidad, y = porcentaje) +
geom_col(fill = "#112446") +
labs(x = "Continuidad de flujo",
y = "Porcentaje ATEs", title = "Continuidad de flujo de agua potable") +
theme_minimal()