Determines whether or not an object exists in a specific namespace.
Usage
exists_in_namespace(x, ns, pos = -1L, envir = as.environment(pos))
Arguments
- x
an object name (given as a character string).
- ns
a namespace, or character string giving the namespace.
- pos
where to look for the object: see
get
.- envir
an alternative way to specify an environment to look in.
Details
This complements utils::getFromNamespace()
and uses almost the same code internally.
Examples
if (pal::is_pkg_installed("pkgpurl")) {
pal::exists_in_namespace("pkg_config", "pkgpurl")
}
#> [1] TRUE
pal::exists_in_namespace("pkg_config", "pal")
#> [1] FALSE