Learn R Programming

photobiology (version 0.11.3)

check_and_rename_vars: check and rename variables

Description

check and rename variables

Usage

check_and_rename_vars(
  x,
  target.var,
  alternative.vars,
  multiplier,
  required = FALSE,
  fill = NULL
)

Arguments

x

data frame or equivalent R object.

target.var

character vector of length one, with the name of the target variable.

alternative.vars

character vector of any length, with the names of the of alternative variables that could replace the target.

multiplier

numeric vector with the multipliers to apply to the alternative variables.

required

logical Indicating whether an error should be triggered if no variable is found.

fill

if required = TRUE and fill different from NULL the value is used to fill the target variable if it and all alternative variables are missing.