Learn R Programming

checkmate (version 1.6.2)

checkNull: Check if an argument is NULL

Description

Check if an argument is NULL

Usage

checkNull(x)

assertNull(x, .var.name)

testNull(x)

Arguments

x
[any] Object to check.
.var.name
[character(1)] Name for x. Defaults to a heuristic to determine the name using deparse and substitute.

Value

  • Depending on the function prefix: If the check is successful, all functions return TRUE. If the check is not successful, assertNull throws an error message, testNull returns FALSE, checkNull returns a string with the error message. The function expect_null will return an expectation.

Examples

Run this code
testNull(NULL)
testNull(1)

Run the code above in your browser using DataLab