From d93fb21567c2d52b9c6034d9d9b61d121aab4caf Mon Sep 17 00:00:00 2001 From: GeraldineGomez Date: Tue, 23 Apr 2024 15:23:12 -0500 Subject: [PATCH] feat: improved data table and order the content Ref: #108 --- R/plotting.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R/plotting.R b/R/plotting.R index aa32c39c..c3212015 100644 --- a/R/plotting.R +++ b/R/plotting.R @@ -1313,8 +1313,12 @@ plot_tabla_incidencia_geo <- function(data_agrupada, "caption_geo_incidence") data_agrupada[[col_geo]] <- stringr::str_to_title(data_agrupada[[col_geo]]) - data_tabla <- data.frame(data_agrupada[[col_geo]], - data_agrupada[["incidencia"]]) + data_tabla <- data_agrupada %>% + group_by_at(c(col_geo, "incidencia")) %>% + dplyr::summarise(incidencia = sum(.data[["incidencia"]]), + .groups = "drop") + data_tabla <- data_tabla[order(data_tabla$incidencia, + decreasing = TRUE), ] tabla_tipos <- knitr::kable(data_tabla, col.names = c(geo_etiqueta, "Incidencia"), align = "c",