Skip to contents

This function returns a standard error message for invalid param values. The param argument is used throughout disputeR to pass the name of the parameter being checked.

Usage

dis_param(x, param = "param", call = rlang::caller_env())

Arguments

x

Required object; a parameter argument to test.

param

Required character scalar; the parameter name. The default value is "param", though this can be modified if you are using a different name for your param argument.

call

Required environment; the environment in which the function was called. If nesting dis_param within another function, it is recommended to provide the calling environment to ensure the correct environment is referenced using rlang::caller_env() (default). If there are multiple levels of nesting, the call argument should be used to pass an environment created in the outermost function.

Value

This function will return either TRUE (if the input passes all validation checks) or an error message.

Details

See the vignette on vignette("developing", package = "disputeR") for details about internal validation of arguments for this function. Unlike the core functions, dis_param does not have a fact_check argument. The vignette("developing", package = "disputeR") vignette includes details on how to implement that functionality around dis_param.

Examples

# create example function that uses dis_param()
example <- function(param){
  dis_param(param)
}

# example function
example(param = "test")
#> [1] TRUE