This function returns a standard error message for invalid call
values. The call argument is used throughout disputeR to
pass the environment of the function being checked.
Usage
dis_environment(x, param = "call", call = rlang::caller_env(),
fact_check = "global")Arguments
- x
Required object; a parameter argument to test.
- param
Required character scalar; the parameter name. The default value is
"call", though this can be modified if you are using a different name for your environment argument.- call
Required environment; the environment in which the function was called. If nesting
dis_paramwithin another function, it is recommended to provide the calling environment to ensure the correct environment is referenced usingrlang::caller_env()(default). If there are multiple levels of nesting, thecallargument should be used to pass an environment created in the outermost function.- fact_check
Required character scalar; whether to override fact checking environment setting. If
"global"(default),dis_characterwill follow the global setting. If"always",dis_characterwill ignore any global setting and will always checkx. This argument is primarily intended for Shiny developers who wish to usedisputeRin modules. See the vignette onvignette("developing", package = "disputeR")for details on how to use this 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(x = rlang::caller_env()){
dis_environment(x)
}
# example function
example()
#> [1] TRUE