Description Usage Arguments Details Author(s) See Also Examples
Internal namespace support functions. Not intended to be called directly, and only visible because of the special nature of the base namespace.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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)
namespaceImportFrom(self, ns, vars, generics, packages,
from = "non-package environment")
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)
|
ns |
string or namespace environment. |
base.OK |
logical. |
impenv |
environment. |
expenv |
namespace environment. |
vars |
character vector. |
generics |
optional character vector. |
self |
namespace environment. |
package |
string naming the package/namespace to load. |
packages |
vector of package names parallel to |
package.lib |
character vector specifying library. |
mustExist |
logical. |
genname |
character. |
class |
character. |
envir, env |
environment. |
info |
a 3-column character matrix. |
which |
character. |
val |
any object. |
... |
character arguments. |
metaname |
the methods table name. |
name |
symbol: name of namespace |
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 ....
Luke Tierney and other members of the R Core Team.
loadNamespace
or getNamespace
are somewhat
higher level namespace related functions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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"
## 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"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.