assert_all_are_existing | R Documentation |
Checks to see if the input variables exist.
assert_all_are_existing(
x,
envir = parent.frame(),
inherits = TRUE,
severity = getOption("assertive.severity", "stop")
)
assert_any_are_existing(
x,
envir = parent.frame(),
inherits = TRUE,
severity = getOption("assertive.severity", "stop")
)
is_existing(
x,
envir = parent.frame(),
inherits = TRUE,
.xname = get_name_in_parent(x)
)
x |
Input to check. |
envir |
Passed to |
inherits |
Passed to |
severity |
How severe should the consequences of the assertion be?
Either |
.xname |
Not intended to be used directly. |
is_existing
is a vectorized wrapper to exists
,
providing more information on failure (and with a simplified interface).
The assert_*
functions return nothing but throw an error if
is_existing
returns FALSE
.
exists
.
e <- new.env()
e$x <- 1
e$y <- 2
assert_all_are_existing(c("x", "y"), envir = e)
#These examples should fail.
assertive.base::dont_stop(assert_all_are_existing(c("x", "z"), envir = e))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.