| is_not_false {fritools} | R Documentation |
Is an Object Set and not Set to 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(x, null_is_false = TRUE, ...)
Arguments
x |
The object to be tested. |
null_is_false |
|
... |
Parameters passed to |
Value
TRUE if the object is set to something
different than FALSE,
FALSE
otherwise.
See Also
Other logical helpers:
get_run_r_tests(),
is_batch(),
is_cran(),
is_false(),
is_force(),
is_installed(),
is_null_or_true(),
is_of_length_zero(),
is_r_cmd_check(),
is_r_package_installed(),
is_running_on_fvafrcu_machines(),
is_running_on_gitlab_com(),
is_success(),
is_version_sufficient(),
is_windows()
Examples
a <- 1
b <- FALSE
c <- NULL
is_not_false(a)
is_not_false(b)
is_not_false(c)
is_not_false(c, null_is_false = FALSE)
is_not_false(not_defined)
f <- function() {
print(a)
print(is_not_false(a))
}
f()
f <- function() {
a <- FALSE
print(a)
print(is_not_false(a))
}
f()
f <- function() {
print(a)
print(is_not_false(a, null_is_false = TRUE,
inherits = FALSE))
}
f()
### We use this to check whether an option is set to something
### different than FALSE:
# Make sure an option is not set:
set_options("test" = NULL, package = "fritools")
tmp <- get_options("test")
is_not_false(tmp)
is_not_false(tmp, null_is_false = FALSE)
# Does not work on the option directly as it is not an object defined:
options("foo" = NULL)
is_not_false(getOption("foo"), null_is_false = FALSE)
[Package fritools version 4.3.0 Index]