% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scenarios_target.R
\name{scenario_fixed_target}
\alias{scenario_fixed_target}
\alias{scenario_fixed_target_col}
\alias{scenario_halt_rise}
\title{Scenario to reach a fixed target}
\usage{
scenario_fixed_target(
  df,
  target_value,
  value_col = "value",
  scenario_col = "scenario",
  start_year = 2018,
  end_year = 2025,
  baseline_year = start_year,
  target_year = end_year,
  scenario_name = glue::glue("{target_value}_{target_year}"),
  small_is_best = FALSE,
  trim = TRUE,
  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"),
  default_scenario = "default"
)

scenario_fixed_target_col(
  df,
  value_col = "value",
  scenario_col = "scenario",
  start_year = 2018,
  end_year = 2025,
  baseline_year = start_year,
  target_col = "target",
  target_year = end_year,
  scenario_name = glue::glue("{target_col}_{target_year}"),
  small_is_best = FALSE,
  trim = TRUE,
  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"),
  default_scenario = "default"
)

scenario_halt_rise(
  df,
  value_col = "value",
  start_year = 2018,
  end_year = 2025,
  baseline_year = start_year,
  target_year = end_year,
  scenario_col = "scenario",
  scenario_name = glue::glue("halt_rise"),
  upper_limit = 100,
  lower_limit = 0,
  trim = TRUE,
  keep_better_values = FALSE,
  small_is_best = FALSE,
  trim_years = TRUE,
  start_year_trim = start_year,
  end_year_trim = end_year,
  ind_ids = billion_ind_codes("all"),
  default_scenario = "default"
)
}
\arguments{
\item{df}{Data frame in long format, where 1 row corresponds to a specific
country, year, and indicator.}

\item{target_value}{value to be achieved by scenario by \code{target_year}}

\item{value_col}{Column name of column with indicator values.}

\item{scenario_col}{Column name of column with scenario identifiers. Useful for
calculating contributions on data in long format rather than wide format.}

\item{start_year}{Start year for scenario, defaults to 2018.}

\item{end_year}{End year for scenario, defaults to 2025}

\item{baseline_year}{Year from which the scenario is measured.
Defaults to \code{start_year}}

\item{target_year}{Year by which the scenario should eventually be
achieved. Defaults to \code{end_year}}

\item{scenario_name}{Name of the scenario. Defaults to scenario_{percent_change}_{baseline_year}}

\item{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).}

\item{trim}{logical to indicate if the data should be trimmed between
\code{upper_limit} and \code{lower_limit}.}

\item{keep_better_values}{logical to indicate if "better" values should be
kept from \code{value_col} if they are present. Follows the direction set in
\code{small_is_best}.  For instance, if small_is_best is TRUE, then \code{value_col} lower
than \code{col} will be kept.}

\item{upper_limit}{limit at which the indicator should be caped.
Can take any of "guess", or any numeric. \code{guess} (default) will take 100 as
the limit if \code{percent_change} is positive, and 0 if negative.}

\item{lower_limit}{limit at which the indicator should be caped.
Can take any of "guess", or 0 to 100. \code{guess} (default) will take 0 as the
limit if \code{percent_change} is positive, and 100 if negative.}

\item{trim_years}{logical to indicate if years before \code{start_year_trim} and after
\code{end_year_trim} should be removed}

\item{start_year_trim}{(integer) year to start trimming from.}

\item{end_year_trim}{(integer) year to end trimming.}

\item{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
\code{billion_ind_codes()}.}

\item{default_scenario}{name of the default scenario to be used.}

\item{target_col}{name of column with targets}
}
\description{
Those scenarios allow to reach a target value from a baseline year by target
year.

\code{scenario_fixed_target()} provides values for scenarios stated as "Reach XX\% in INDICATOR by
YEAR" or "Eliminate XX by YEAR".

\code{scenario_fixed_target_col()} wraps around \code{scenario_fixed_target} to provide
targets from a column specified in \code{target_col} rather than a single value.

\code{scenario_halt_rise()} is a special case of \code{scenario_fixed_target_col()}
where each country aims at a value of a specific year.

The returned scenario is a portion of the straight line drawn from the
\code{baseline_year} value to the \code{target_year}. Only values for years between
\code{start_year} and \code{end_year} will be returned.

If \code{value_col} has values that are higher or lower than the scenario values, then
only \code{value_col} will be kept, depending on \code{small_is_best}. For instance,
if the scenario value is 80 and the value 75 and small_is_best is TRUE, then
75 will be kept.
}
\concept{fixed_target}
