massert: Conduct Multiple Assertions

View source: R/massert.R

massertR Documentation

Conduct Multiple Assertions

Description

This documentation attempts to describe arguments to make assertions on arguments. In order to prevent confusion, it is imperative to develop some terminology up front. We will use function argument to refer to an argument of the function for which we are conducting assertions. We will use assertion argument to refer to arguments to pass to the assertion function being applied to a function argument. Lastly, we will use massert argument to refer to arguments to massert

Usage

massert(formula, fun, ..., fixed = list())

Arguments

formula

A one sided formula naming the arguments on which the assertion will be performed.

fun

An assertion function to perform.

...

Additional lists. Each argument provided is a named list of ⁠assertion arguments⁠. The name of each element in a list should match the name of a ⁠function argument⁠. lower = list(var1 = 0, var2 = 10) sets the assertion argument lower = 0 for function argument var1; and sets the assertion argument lower = 10 for ⁠function argument⁠ var2. The massert arguments in ... may themselves be named or unnamed.

fixed

A named list of arguments that are fixed across all assertions.

Details

Only one assert function may be utilized in each call to massert. This allows for all numeric variables to be checked in one call, all logical variables to be checked in a subsequent call, etc.


redcapAPI documentation built on Sept. 13, 2023, 1:07 a.m.