check_value: Check the input value to a parent function argument

View source: R/utils.R

check_valueR Documentation

Check the input value to a parent function argument

Description

Within a function, this function checks the value of an input to an argument of that function. If the input value is supported, the function simply returns this value. If the input is not supported, the function returns a warning and the default value. This function is designed to be implemented internally within functions and not intended for general use.

Usage

check_value(arg = deparse(substitute(input)), input, supp, default = supp[1])

Arguments

arg

A character string which defines the argument of the parent function.

input

The input to an argument of a parent function.

supp

A vector of supported input values for the argument in the parent function.

default

The default input value for the parent function.

Value

The function returns input or default (the latter with a warning) depending on whether or not input is within supp (i.e., whether or not the input to the argument of a parent function is supported).

Author(s)

Edward Lavender


edwardlavender/Tools4ETS documentation built on Nov. 29, 2022, 7:41 a.m.