Trim values
Usage
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
)Arguments
- 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
upper_limitandlower_limit.- 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
value_colif they are present. Follows the direction set insmall_is_best. For instance, if small_is_best is TRUE, thenvalue_collower thancolwill be kept.- 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_trimand afterend_year_trimshould be removed- start_year_trim
(integer) year to start trimming from.
- end_year_trim
(integer) year to end trimming.
See also
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()