Computes basic descriptive statistics (mean, median, sd) for all numeric
columns in df, grouped by one or more keys.
Value
A tibble with the grouping keys and one column per
statistic/variable, named as {var}_{stat} (e.g., od_mean, od_median, od_sd).
Details
Grouping columns not found in
dfare silently dropped.If no grouping columns remain, an error is thrown.
Only numeric columns are summarized; if none exist, an error is thrown.
Missing values are ignored (
na.rm = TRUE).
Examples
# \donttest{
# Using the demo dataset shipped with the package
d <- wq_demo
# Example: group by point (ponto)
s1 <- resume_wq(d, by = "ponto")
head(s1)
#> # A tibble: 4 × 34
#> ponto ph_mean ph_median ph_sd od_mean od_median od_sd turbidez_mean
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 FBS-BRH-250 7.41 7.55 0.664 6.44 6.13 0.671 41.7
#> 2 FBS-BRH-300 7.19 7.08 1.12 6.84 6.7 0.550 47.4
#> 3 FBS-BRH-450 7.47 7.57 0.591 6.42 6.05 1.02 14.4
#> 4 FBS-BRH-950 7.09 7.18 0.271 6.91 6.1 2.19 14.5
#> # ℹ 26 more variables: turbidez_median <dbl>, turbidez_sd <dbl>,
#> # dbo_mean <dbl>, dbo_median <dbl>, dbo_sd <dbl>, coliformes_mean <dbl>,
#> # coliformes_median <dbl>, coliformes_sd <dbl>, p_total_mean <dbl>,
#> # p_total_median <dbl>, p_total_sd <dbl>, nt_total_mean <dbl>,
#> # nt_total_median <dbl>, nt_total_sd <dbl>, temperatura_mean <dbl>,
#> # temperatura_median <dbl>, temperatura_sd <dbl>, tds_mean <dbl>,
#> # tds_median <dbl>, tds_sd <dbl>, lat_mean <dbl>, lat_median <dbl>, …
# Example: group by point and month (if 'mes' exists in your data)
# s2 <- resume_wq(d, by = c("ponto", "mes"))
# }