Does the requested input exist in the environment?

isExisting(x, envir = parent.frame(), inherits = FALSE,
  .xname = getNameInParent(x))

isNonExisting(x, envir = parent.frame(), inherits = FALSE,
  .xname = getNameInParent(x))

allAreExisting(x, envir = parent.frame(), inherits = FALSE,
  .xname = getNameInParent(x))

allAreNonExisting(x, envir = parent.frame(), inherits = FALSE,
  .xname = getNameInParent(x))

Arguments

x

character. Variable names to check in environment.

envir

environment. Environment.

inherits

logical(1). Should the enclosing frames of the environment be searched?

.xname

Not intended to be used directly.

Value

TRUE on success; FALSE on failure, with cause attribute set.

Functions

  • isExisting: Vectorized.

  • isNonExisting: Vectorized.

  • allAreExisting: Scalar.

  • allAreNonExisting: Scalar.

Note

exists only supports character(1), so we are exporting isExisting as a convenience function to check multiple variables in a single call.

See also

Examples

a <- 1L b <- 2L ## TRUE ==== isExisting(c("a", "b"))
#> a b #> TRUE TRUE
allAreNonExisting(c("x", "y"))
#> [1] TRUE
## FALSE ==== isExisting(c("x", "y"))
#> There were 2 failures: #> pos value cause #> 1 1 x non-existing #> 2 2 y non-existing