is_not_false {cleanr} | R Documentation |
Sometimes you need to know whether or not an object exists and is not set to FALSE (and possibly not NULL).
is_not_false(object, null_is_false = TRUE, ...)
object |
The object to be tested. |
null_is_false |
[boolean(1)] |
... |
Parameters passed to |
Pass an environment if you call the function elsewhere than from
.GlobalEnv
.
TRUE if the object is set to something different than FALSE, FALSE otherwise.
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())