
Internal namespace support functions. Not intended to be called directly, and only visible because of the special nature of the base namespace.
asNamespace(ns, base.OK = TRUE)
getNamespaceInfo (ns, which)
.getNamespaceInfo(ns, which)
importIntoEnv(impenv, impnames, expenv, expnames)
isBaseNamespace(ns)
isNamespace(ns)
namespaceExport(ns, vars)
namespaceImport(self, …, from = NULL, except = character(0L))
namespaceImportFrom(self, ns, vars, generics, packages,
from = "non-package environment",
except = character(0L))
namespaceImportClasses(self, ns, vars, from = NULL)
namespaceImportMethods(self, ns, vars, from = NULL)
packageHasNamespace(package, package.lib)
parseNamespaceFile(package, package.lib, mustExist = TRUE)
registerS3method(genname, class, method, envir = parent.frame())
registerS3methods(info, package, env)
setNamespaceInfo(ns, which, val)
.mergeExportMethods(new, ns)
.mergeImportMethods(impenv, expenv, metaname)
.knownS3Generics
loadingNamespaceInfo()
.getNamespace(name)
..getNamespace(name, where)
string or namespace environment.
logical.
environment.
namespace environment.
character vector.
optional character vector.
namespace environment.
string naming the package/namespace to load.
vector of package names parallel to generics
.
character vector specifying library.
logical.
character.
character.
environment.
a 3-column character matrix.
character.
any object.
character arguments.
the methods table name.
symbol: name of namespace
character vector naming symbols to exclude from the
import, particularly useful when vars
is missing.
packageHasNamespace
does not indicate if the package has a
namespace (all now do), rather if it has a NAMESPACE
file,
which base and some legacy packages do not. But then you are
not intended to be using it ….
loadNamespace
or getNamespace
are somewhat
higher level namespace related functions.
# NOT RUN {
nsName <- "stats"
(ns <- asNamespace(nsName)) # <environment: namespace:stats>
## Inverse function of asNamespace() :
environmentName(asNamespace("stats")) # "stats"
environmentName(asNamespace("base")) # "base"
getNamespaceInfo(ns, "spec")[["name"]] ## -> "stats"
# }
# NOT RUN {
## Only for for the daring ones, trying to get into the bowels :
lsNamespaceInfo <- function(ns, ...) {
ns <- asNamespace(ns, base.OK = FALSE)
ls(..., envir = get(".__NAMESPACE__.", envir = ns, inherits = FALSE))
}
allinfoNS <- function(ns) sapply(lsNamespaceInfo(ns), getNamespaceInfo, ns=ns)
utils::str(allinfoNS("stats"))
utils::str(allinfoNS("stats4"))
# }
Run the code above in your browser using DataLab