View source: R/aggregation_diagnostics.R
| aggregation_diagnostics | R Documentation |
This convenience function runs all six diagnostic functions in the package, mean divergence, normalized divergence, mean standard deviation, mean range, share of events with disagreement, and modal confidence, and returns a combined tibble with one row per variable.
aggregation_diagnostics(data, group_var, variables)
data |
A data frame containing event report level data. |
group_var |
A character string naming the column that uniquely identifies events (e.g., "event_id"). |
variables |
A character vector of column names to include in the diagnostics. |
The function handles mixed-type input: each diagnostic is only run on the subset of variables for which it is valid. Variables that do not apply to a particular diagnostic will have 'NA' in that column.
A tibble with one row per variable and columns:
The name of each variable.
Mean divergence score.
Normalized divergence score.
Mean within-event standard deviation (numeric variables only).
Mean within-event range (numeric variables only).
Share of events with any disagreement.
Average modal confidence per variable.
#' @importFrom dplyr full_join
small_maverick_event_report %>%
aggregation_diagnostics(
group_var = "event_id",
variables = c("city", "deaths_best", "actor1")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.