dot-validateArg: Validates arguments. Allows partial matching.

Description Usage Arguments Details Value

Description

Validates arguments. Allows partial matching.

Usage

1
.validateArg(arg, parent = NULL, ignore.case = T)

Arguments

arg

variable; the variable in which to check

parent

closure; the parent function in which to check the input

ignore.case

boolean; ignores case of the choices

Details

Check the parent function input arguments to see whether the inputted value is part of the set. Will return a formatted error message with the incorrect variable name and all the acceptable inputs.

To use, it can be called as such:

genericFunc <- function(values = c("apple","orange","banana"))

values <- .validateArg(values)

If the argument for values is acceptable (e.g. "apple" or "ban"), it will return the matched string.

This can be used with pipes, but will give erroneous names for the input variable

Value

arg, if the value is in the function definition.


CompEpigen/scMethrix documentation built on Nov. 6, 2021, 3:09 p.m.