Skip to contents

This takes the aggregations at each stage along the theme axis, extracts the aggregated values for a given aggregation history (ie the sequence of aggregation functions), and returns in a form that can be added to edges or nodes dfs.

Usage

extract_vals_causal(agglist, whichaggs, valcol, targetlevels = names(agglist))

Arguments

agglist

a list of tibbles of each step in the theme aggregation (output of theme_agg_multi with saveintermediate = TRUE). Currently assumes the aggregation history is already in columns (either theme_agg_multi with namehistory = FALSE or have run agg_names_to_cols). Would be fairly easy to detect and add a call to agg_names_to_cols if this becomes an issue.

whichaggs

a character vector or list with one string per list item of the desired sequence of aggregation functions. This has to have only values used in the aggregation used to create agglist, and can have only one entry per step (unlike in the creation of agglist). If different aggregation histories are required, this should be run again, because it is not appropriate to mix histories in a causal plot.

valcol

character, name of the column with the aggregated values.

targetlevels

character, names of levels to include. Defaults to names(agglist). Any subset of those names can be used.

Value

a tibble with grouping variables for scenario and gauge, a column for values named the same as valcol, and Name and NodeType columns to allow joining to the node df.