View source: R/scenarios_specific_scenarios.R
scenario_best_of | R Documentation |
scenario_best_of
picks the best value between multiple scenarios specified
in scenario_names
. small_is_best
allows to pick if higher value or
smaller values are best.
scenario_best_of(
df,
scenario_names,
value_col = "value",
maximize_end_year = TRUE,
start_year = 2018,
end_year = 2025,
target_year = end_year,
scenario_name = glue::glue("best_of_{paste0(scenario_names, collapse = '_')}"),
scenario_col = "scenario",
trim = TRUE,
small_is_best = FALSE,
keep_better_values = TRUE,
upper_limit = 100,
lower_limit = 0,
trim_years = TRUE,
start_year_trim = start_year,
end_year_trim = end_year,
ind_ids = billion_ind_codes("all")
)
df |
Data frame in long format, where 1 row corresponds to a specific country, year, and indicator. |
scenario_names |
names of the scenario to pick from. |
value_col |
Column name of column with indicator values. |
maximize_end_year |
(Boolean) if TRUE, the best scenario is
picked on the best value at |
start_year |
Start year for scenario, defaults to 2018. |
end_year |
End year for scenario, defaults to 2025 |
target_year |
Year by which the scenario should eventually be
achieved. Defaults to |
scenario_name |
Name of the scenario. Defaults to scenario_percent_change_baseline_year |
scenario_col |
Column name of column with scenario identifiers. Useful for calculating contributions on data in long format rather than wide format. |
trim |
logical to indicate if the data should be trimmed between
|
small_is_best |
Logical to identify if a lower value is better than a higher one (e.g. lower obesity in a positive public health outcome, so obesity rate should have small_is_best = TRUE). |
keep_better_values |
logical to indicate if "better" values should be
kept from |
upper_limit |
limit at which the indicator should be caped.
Can take any of "guess", or any numeric. |
lower_limit |
limit at which the indicator should be caped.
Can take any of "guess", or 0 to 100. |
trim_years |
logical to indicate if years before |
start_year_trim |
(integer) year to start trimming from. |
end_year_trim |
(integer) year to end trimming. |
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
|
If multiple scenario are tied for the best scenario, the scenario with the best time
series for each iso3
and ind
is picked. If they are still tied scenarios for
the best value, the first in alphabetical order is picked.
Basic scenarios
scenario_aroc()
,
scenario_bau()
,
scenario_linear_change()
,
scenario_percent_baseline()
Comparing scenarios
scenario_bau()
,
scenario_best_in_region()
,
scenario_quantile()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.