View source: R/utils-scenarios.R
| trim_values | R Documentation |
Trim values
trim_values(
df,
col,
value_col = "value",
baseline_col = value_col,
trim = TRUE,
small_is_best = FALSE,
keep_better_values = FALSE,
upper_limit = 100,
lower_limit = 0,
trim_years = TRUE,
start_year_trim = 2018,
end_year_trim = 2025
)
df |
Data frame in long format, where 1 row corresponds to a specific country, year, and indicator. |
col |
column to trim values from. Will be removed before returning the data frame. |
value_col |
Column name of column with indicator values. This column will be used to return the results. |
baseline_col |
Column name with baseline values. This is used to ensure that trimmed values do not get worst values than baseline. |
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 |
upper limit at which the indicator should be caped. |
lower_limit |
lower_limit limit at which the indicator should be caped. |
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. |
trimed data frame, removing the col column, and putting the trimmed
values in value_col
General scenario functions
add_scenario(),
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_years()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.