From 61c0d0f5d8582cc09f627b2c73a818cb13d4840d Mon Sep 17 00:00:00 2001 From: GeraldineGomez Date: Thu, 25 Apr 2024 07:25:57 -0500 Subject: [PATCH] fix(calcular_incidencia_sex): group data by event and calculation Ref: #108 --- R/checking_data.R | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/R/checking_data.R b/R/checking_data.R index bdfa2efa..3bdb98f5 100644 --- a/R/checking_data.R +++ b/R/checking_data.R @@ -1138,6 +1138,16 @@ calcular_incidencia_sex <- function(data_incidencia, mpio <- dept_data$codigo_municipio } } + cod_eve <- data_agrupada$cod_eve[1] + nombre_evento <- data_agrupada$nombre_evento[1] + data_agrupada <- data_agrupada %>% + group_by_at("sexo") %>% + dplyr::summarise(casos = sum(.data[["casos"]]), .groups = "drop") + cols_eve <- data.frame(cod_eve = rep(cod_eve, + nrow(data_agrupada)), + nombre_evento = rep(nombre_evento, + nrow(data_agrupada))) + data_agrupada <- cbind(data_agrupada, cols_eve) for (fila in seq_len(nrow(data_agrupada))) { sex_fila <- data_agrupada[fila, ] incidencia_sex <- calcular_incidencia(data_incidencia = data_incidencia,