assert_logical_scalar: Is an Argument a Logical Scalar (Boolean)?

Description Usage Arguments Value Author(s) Examples

View source: R/assertions.R

Description

Checks if an argument is a logical scalar

Usage

1

Arguments

arg

A function argument to be checked

Value

The function throws an error if arg is neither TRUE or FALSE. Otherwise, the input is returned invisibly.

Author(s)

Thomas Neitmann

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
example_fun <- function(flag) {
  assert_logical_scalar(flag)
}

example_fun(FALSE)

try(example_fun(NA))

try(example_fun(c(TRUE, FALSE, FALSE)))

try(example_fun(1:10))

epijim/admiral documentation built on Feb. 13, 2022, 12:15 a.m.