Add isNamespaceLoaded added in 3.2.0
Closed this issue · 1 comments
msberends commented
The isNamespaceLoaded()
function was only introduced in R 3.2.0 (just checked because we want our package to support any R version since 3.0.0).
Per the documentation of ns-load
:
requireNamespace
is a wrapper forloadNamespace
analogous torequire
that returns a logical value.
loadedNamespaces
returns a character vector of the names of the loaded name spaces.
isNamespaceLoaded(pkg)
is equivalent to but more efficient thanpkg %in% loadedNamespaces()
.
So I think it's just:
isNamespaceLoaded <- function(pkg) {
pkg %in% loadedNamespaces()
}
mllg commented
I missed that one, now in master.