assert: Assert that Certain Conditions are Met

View source: R/assert.R

assertR Documentation

Assert that Certain Conditions are Met

Description

Ensures that a variable respects several parameters

Usage

assert(x, len = NULL, cla = NULL, typ = NULL, alw = NULL, fun = "stop")

Arguments

x

variable to test

len

integer vector of allowed length for x. Default is NULL, for not checking this parameter.

cla

character vector of allowed classes of x. Default is NULL, for not checking this parameter.

typ

character vector of allowed types of x. Default is NULL, for not checking this parameter.

alw

allowed values for x. Default is NULL, for not checking this parameter.

fun

function to execute when mandatory parameters are not met. Default is "stop". Allowed are "stop","warning","message","return".

Details

/!\ alw parameter when used should be coercible to a logical, integer, numeric, complex or character vector. Otherwise, an error will be thrown.


IFC documentation built on Sept. 14, 2023, 1:08 a.m.