Learn R Programming

cleanr (version 1.1.3)

is_not_false: Test if an Object is not False

Description

Sometimes you need to know whether or not an object exists and is not set to FALSE (and possibly not NULL).

Usage

is_not_false(object, null_is_false = TRUE, ...)

Arguments

object
The object to be tested.
null_is_false
[boolean(1)] Should NULL be treated as FALSE?
...
Parameters passed to exists. See Details and Examples.

Value

TRUE if the object is set to something different than FALSE, FALSE otherwise.

Details

Pass an environment if you call the function elsewhere than from .GlobalEnv.

Examples

Run this code
a  <- 1
is_not_false(a)
f <- function() {
    a <- NULL
    should_be_true <- ! is_not_false(a, null_is_false = TRUE, 
                                      where = environment())
    return(should_be_true)
}
print(f())

Run the code above in your browser using DataLab