This help topic is for R version 1.7.1. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/ns-lowlev.html
ns-lowlev {base}R Documentation

Low Level Name Space Support Functions

Description

Low level name space support functions.

Usage

attachNamespace(ns, pos = 2)
loadNamespace(package, lib.loc = NULL,
              keep.source = getOption("keep.source.pkgs"))
loadedNamespaces()
unloadNamespace(ns)

Arguments

ns

string or namespace object.

pos

integer specifying position to attach.

package

string naming the package/name space to load.

lib.loc

character vector specifying library search path.

keep.source

logical specifying whether to retain source.

Details

The functions loadNamespace and attachNamespace are usually called implicitly when library is used to load a name space and any imports needed. However it may be useful to call these functions directly at times.

loadNamespace loads the specified name space and registers it in an internal data base. A request to load a name space that is already loaded has no effect. The arguments have the same meaning as the corresponding arguments to library. After loading, loadNamespace looks for a hook function named .onLoad as an internal variable in the name space (it should not be exported). This function is called with the same arguments as .First.lib.

loadNamespace does not attach the name space it loads to the search path. attachNamespace can be used to attach a frame containing the exported values of a name space to the search path. The hook function .onAttach is run after the name space exports are attached, but this is not likely to be useful. Shared library loading and setting of options should be handled at load time by the .onLoad hook.

loadedNamespaces returns a character vector of the names of the loaded name spaces. unloadNamespace can be used to force a name space to be unloaded. An error is signaled if the name space is imported by other loaded name spaces. If defined, a hook function .onUnload, analogous to .Last.lib, is run after removing the name space from the internal registry.

Author(s)

Luke Tierney


[Package base version 1.7.1 ]