Groups data by time variables (ano, mes) and optional spatial variables (UF, municipio, regiao) and computes descriptive summaries of key numeric columns.
Arguments
- dados
A processed VIGIAR tibble (or any data frame with
anocolumn).- agregar_por
Character vector of grouping variables. Default:
c("ano"). Other options:"mes","sigla_uf","cod_municipio","regiao".- variavel
Name of the numeric column to summarise. If
NULL, auto-detects based on the data class.- funcoes
Named list of summary functions. Default:
list(media = mean, n = length).
Examples
vigiar_agregar_tempo(pm25_rj_sample, agregar_por = "ano")
#> # A tibble: 3 × 3
#> ano pm25_media_anual_media pm25_media_anual_n
#> <int> <dbl> <int>
#> 1 2020 10.9 5
#> 2 2021 8.9 5
#> 3 2022 9.22 5
vigiar_agregar_tempo(pm25_rj_sample, agregar_por = c("ano", "sigla_uf"))
#> # A tibble: 3 × 4
#> ano sigla_uf pm25_media_anual_media pm25_media_anual_n
#> <int> <chr> <dbl> <int>
#> 1 2020 RJ 10.9 5
#> 2 2021 RJ 8.9 5
#> 3 2022 RJ 9.22 5