check_logical: Checks a set of variables can be coerced to a logical and...

View source: R/params_check_types.R

check_logicalR Documentation

Checks a set of variables can be coerced to a logical and coerces them

Description

Checks a set of variables can be coerced to a logical and coerces them

Usage

check_logical(
  ...,
  .message = "`{param}` is not a logical: ({err}).",
  .env = rlang::caller_env()
)

Arguments

...

a list of symbols

.message

a glue specification containing {param} as the name of the parameter and {err} the cause of the error

.env

the environment to check (defaults to calling environment)

Value

nothing. called for side effects. throws error if not all variables can be coerced.

Examples

a = c("T","F")
b = c(1,0,1,0)
f = TRUE
g = NA
check_logical(a,b,f,g)

c = c("dfsfs")
try(check_logical(c,d, mean))

interfacer documentation built on April 4, 2025, 6:13 a.m.