apply_benchmarks: Apply benchmarks to data

View source: R/benchmarking.R

apply_benchmarksR Documentation

Apply benchmarks to data

Description

Using data that has unique identifier and indicator value variables, apply benchmarks. The benchmarks are applied to the data based on the benchmark group(s) that the data belong to, which may already be assigned in the data or may be added with a benchmark group lookup table.

Usage

apply_benchmarks(
  data,
  benchmarks,
  data_id_vars,
  data_group_var = NULL,
  benchmark_group_var = "Benchmark_Group",
  benchmark_indicator_var = "Indicator",
  use_tdat_indicator_lookup = TRUE
)

Arguments

data

Data frame. The data to be benchmarked. Must contain the variable(s) in data_id_vars as unique identifiers. May be "wide" or "long" data. If wide, then each indicator name should be a variable name. If long, then the indicator names and values should be in variables named "indicator_var" and "value".

benchmarks

Data frame. The benchmarks in the format produced by read_benchmarks().

data_id_vars

Character string or vecor of character strings. The names of the variable(s) in data which serve as unique identifiers.

data_group_var

Optional character string. The name of the variable that holds the benchmark group memberships. If NULL then it defaults to the variable in benchmark_group_var. Defaults to NULL.

benchmark_group_var

Character string. The name of the variable that holds the benchmark group memberships. Defaults to "Benchmark_Group".

benchmark_indicator_var

Character string. The name of the variable that holds the indicator names in the benchmarks. Defaults to "Indicator".

use_tdat_indicator_lookup

Logical. Set to TRUE if the the values in variable benchmark_indicator_var are the standard human-readable names for the indicators and the corresponding variables in data use the variable names from the Terrestrial AIM Database. Defaults to TRUE.

Value

A long data frame of each point/benchmarked indicator combination with the assigned condition category.


nstauffer/aim.analysis documentation built on Nov. 20, 2024, 8:38 a.m.