Check whether an object contains a valid logical value
is_logical(x)
object to check. A scalar is assumed.
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.
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')"