Learn R Programming

envnames (version 0.4.1)

is_logical: Check whether an object contains a valid logical value

Description

Check whether an object contains a valid logical value

Usage

is_logical(x)

Arguments

x

object to check. A scalar is assumed.

Value

boolean indicating whether the scalar object contains a valid logical value (i.e. TRUE or FALSE) and is not NA nor NULL, and has positive length. FALSE is returned if the object does not exist.

Details

This function silently handles special cases for which is.null() and is.na() (called by this function) may return a warning, such as functions objects or environments. (e.g. the warning "Warning message: In is.na(g) : is.na() applied to non-(list or vector) of type 'closure')"