assert: Assert if condition is true

View source: R/assert.R

assertR Documentation

Assert if condition is true

Description

Throw error if condition false

Usage

assert(cond, msg = "Assertion failed.", A = NULL)

Arguments

cond

Logical test

msg

Error message to be displayed if cond == FALSE

A

values to format msg if the latter contains C-style formatting commands. formatted as parsable

Value

The error message if cond == FALSE, nothing otherwise

Author(s)

Waldir Leoncio

Examples

minVal <- 7
x <- 26
assert(minVal < x) # should return nothing
maxVal <- 13
## Not run: 
  assert((minVal < x) && (x < maxVal))
  assert(x == "a", "x is %s", class(x))

## End(Not run)

matlab2r documentation built on Feb. 16, 2023, 10:39 p.m.

Related to assert in matlab2r...