add_scenario() wraps around add_scenario_indicator() to add the scenario
specified in scenario_function to all the valid billionaiRe indicators
present in df.
Usage
add_scenario(
df,
scenario_function = c("aroc", "halt_rise", "percent_baseline", "linear_change",
"linear_change_col", "quantile", "best_in_region", "fixed_target",
"fixed_target_col", "bau", "accelerate", "accelerate_target", "sdg", "benchmarking",
"covid_rapid_return", "covid_delayed_return", "covid_sustained_disruption",
"return_previous_trajectory", "top_n_iso3"),
ind_ids = billion_ind_codes("all"),
scenario_col = "scenario",
start_year = 2018,
end_year = 2025,
default_scenario = "default",
make_default = FALSE,
start_scenario_last_default = TRUE,
...
)
add_scenario_indicator(
df,
scenario_function = c("aroc", "halt_rise", "percent_baseline", "linear_change",
"linear_change_col", "quantile", "best_in_region", "fixed_target",
"fixed_target_col", "bau", "accelerate", "accelerate_target", "sdg", "benchmarking",
"covid_rapid_return", "covid_sustained_disruption", "covid_delayed_return",
"covid_never_return", "return_previous_trajectory", "top_n_iso3"),
indicator,
start_year = 2018,
ind_ids = billion_ind_codes("all"),
scenario_col = "scenario",
default_scenario = "default",
bau_scenario = "historical",
make_default = FALSE,
expend_bau = FALSE,
start_scenario_last_default = TRUE,
...
)Arguments
- df
Data frame in long format, where 1 row corresponds to a specific country, year, and indicator.
- scenario_function
character identifier of scenario to use. Can be any of the following:
aroc: callsscenario_arochalt_rise: callsscenario_halt_risepercent_baseline: callsscenario_percent_baselinelinear_change: callsscenario_linear_changelinear_change_col: callsscenario_linear_change_colquantile: callsscenario_quantilebest_in_region: callsscenario_best_in_regionfixed_target: callsscenario_fixed_targetfixed_target_col: callsscenario_fixed_target_colbau: callsscenario_bauaccelerate: calls indicator accelerate function.accelerate_target: calls indicator accelerate function to specified targets.sdg: calls Sustainable Development Goals (SDG) acceleration function.benchmarking: calls benchmarking scenarios.covid_rapid_returncallsscenario_covid_rapid_returncovid_delayed_returncallsscenario_covid_delayed_returncovid_sustained_disruptioncallsscenario_covid_sustained_disruptionreturn_previous_trajectorycallsscenario_return_previous_trajectorytop_n_iso3callsscenario_top_n_iso3
- ind_ids
Named vector of indicator codes for input indicators to the Billion. Although separate indicator codes can be used than the standard, they must be supplied as a named vector where the names correspond to the output of
billion_ind_codes().- scenario_col
Column name of column with scenario identifiers. Useful for calculating contributions on data in long format rather than wide format.
- start_year
Base year for contribution calculation, defaults to 2018.
- end_year
End year(s) for contribution calculation, defaults to 2019 to 2025.
- default_scenario
name of the default scenario.
- make_default
(Boolean) if
TRUE, thenmake_default_scenariois used to generate thedefault_scenario- start_scenario_last_default
(Boolean) if
TRUE, then the last year with values in thedefault_scenariois the starting point of the scenario, and notstart_year.- ...
additional parameters to be passed to the add_scenario_indicator function (e.g.
add_scenario_adult_obese).- indicator
name of indicator to be passed to
scenario_function- bau_scenario
name of scenario to be used for business as usual. Default is
historical.- expend_bau
(Boolean)if
TRUE, thenmake_default_scenariois used to expendbau_scenarioto the start of thedefault_scenario.
Details
add_scenario_indicator() gets the right add_scenario_ function for the
indicator specified and adds the scenario.
See also
General scenario functions
calculate_aarc(),
calculate_aroc(),
exec_scenario(),
fill_cols_scenario(),
flat_extrapolation(),
get_aarr(),
get_baseline_value(),
get_baseline_year(),
get_last_value(),
get_last_year_scenario(),
get_latest_aarc(),
get_percent_change_aarc(),
get_target_aarc(),
remove_unwanted_scenarios(),
trim_values(),
trim_years()