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 × 28
#> ponto ph_mean ph_median ph_sd od_mean od_median od_sd turbidez_mean
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 P1 7.70 7.88 0.731 6.41 6.21 1.73 53.6
#> 2 P2 7.41 7.46 0.672 5.77 5.03 1.43 27.7
#> 3 P3 7.11 7.14 0.236 6.41 5.92 1.54 29.3
#> 4 P4 7.04 6.97 0.284 7.16 8.05 1.27 51.6
#> # ℹ 20 more variables: turbidez_median <dbl>, turbidez_sd <dbl>,
#> # dbo_mean <dbl>, dbo_median <dbl>, dbo_sd <dbl>, coliformes_mean <dbl>,
#> # coliformes_median <int>, 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>
# Example: group by point and month (if 'mes' exists in your data)
# s2 <- resume_wq(d, by = c("ponto", "mes"))
# }