Skip to content

Commit

Permalink
feat(plot_tabla_incidencia_geo): added geo code and re-group the even…
Browse files Browse the repository at this point in the history
…t data

Ref: #108
  • Loading branch information
GeraldineGomez committed Apr 24, 2024
1 parent 0ae3dde commit b5b099d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/plotting.R
Original file line number Diff line number Diff line change
Expand Up @@ -1340,20 +1340,20 @@ plot_tabla_incidencia_geo <- function(data_agrupada,
package = "sivirep"),
"label_code")
if (is.null(col_geo)) {
col_geo <- nomb_cols[2]
col_geo <- nomb_cols[1:2]
}
if (nomb_cols[3] %in% colnames(data_agrupada) &&
length(unique(data_agrupada[[nomb_cols[1]]])) == 1) {
geo_etiqueta <- "Municipio"
col_geo <- nomb_cols[4]
etiqueta_geo <- "Municipio"
col_geo <- nomb_cols[3:4]
}
caption_tabla <- config::get(file =
system.file("extdata",
"config.yml",
package = "sivirep"),
"caption_geo_incidence")
data_agrupada[[col_geo]] <-
stringr::str_to_title(data_agrupada[[col_geo]])
data_agrupada[[col_geo[2]]] <-
stringr::str_to_title(data_agrupada[[col_geo[2]]])
data_tabla <- data_agrupada %>%
group_by_at(c(col_geo, "incidencia")) %>%
dplyr::summarise(incidencia = sum(.data[["incidencia"]]),
Expand All @@ -1369,7 +1369,7 @@ plot_tabla_incidencia_geo <- function(data_agrupada,
kableExtra::row_spec(0, color = "white", background = "#2274BB") %>%
kableExtra::kable_styling(full_width = FALSE,
latex_options = "HOLD_position")
return(tabla_tipos)
return(tabla_geo)
}

#' Generar tabla con la incidencia por sexo
Expand Down

0 comments on commit b5b099d

Please sign in to comment.