Learn R Programming

mlr3misc (version 0.17.0)

check_operators: Logical Check Operators

Description

Logical AND and OR operators for check_*-functions from checkmate.

Usage

lhs %check&&% rhs

lhs %check||% rhs

Value

Either TRUE or a character(1).

Arguments

lhs, rhs

(function())
check_*-functions that return either TRUE or an error message as a character(1).

Examples

Run this code
library(checkmate)

x = c(0, 1, 2, 3)
check_numeric(x) %check&&% check_names(names(x), "unnamed")  # is TRUE
check_numeric(x) %check&&% check_true(all(x < 0))  # fails

check_numeric(x) %check||% check_character(x)  # is TRUE
check_number(x) %check||% check_flag(x)  # fails

Run the code above in your browser using DataLab