View source: R/add_scenarios.R
add_scenario | R Documentation |
add_scenario()
wraps around add_scenario_indicator()
to add the scenario
specified in scenario_function
to all the valid billionaiRe indicators
present in df
.
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", include_calculated = TRUE),
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", include_calculated = TRUE),
scenario_col = "scenario",
default_scenario = "default",
bau_scenario = "historical",
make_default = FALSE,
expend_bau = FALSE,
start_scenario_last_default = TRUE,
...
)
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:
|
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
|
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 |
start_scenario_last_default |
(Boolean) if |
... |
additional parameters to be passed to the add_scenario_indicator
function (e.g. |
indicator |
name of indicator to be passed to |
bau_scenario |
name of scenario to be used for business as usual.
Default is |
expend_bau |
(Boolean)if |
add_scenario_indicator()
gets the right add_scenario_
function for the
indicator specified and adds the scenario.
data frame with additional rows with scenario values.
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.