

   LLooaaddiinngg aanndd LLiissttiinngg ooff PPaacckkaaggeess

        library(name, help = NULL, lib.loc = .lib.loc,
             character.only = FALSE, logical.return = FALSE)
        require(name, quietly = FALSE)
        provide(name)

        library.dynam(chname)

        .packages()
        .lib.loc
        .Library
        .Provided

   AArrgguummeennttss::

   name, help: `name' or character string giving the name of a
             package

    lib.loc: a character vector describing the location of
             library trees to search through.

   character.only: a logical indicating whether `name' or
             `help' can be assumed to be character strings

    quietly: if `TRUE', a warning will not be printed if the
             package cannot be found.

     chname: a character string naming a shared library to load

   DDeessccrriippttiioonn::

        `library(name)' and `require(name)' both load the pack-
        age with name `name'.  `require' is designed for use
        inside other functions; it returns `FALSE' and option-
        ally gives a warning, rather than giving an error, if
        the package does not exist.  Both functions check and
        update the list of currently loaded packages and do not
        reload code that is already loaded.  `require' also
        checks the list `.Provided'.

        `provide' allows code to register services that it pro-
        vides.  The argument is stored in the list `.Provided'.
        `provide' returns `FALSE' if the name was already pre-
        sent in `.Provided' or among the packages in
        `search()'.  The main use for `provide' is when multi-
        ple packages share code.    This is most likely when
        the code implements features present in S(-PLUS) but
        not in R. For example, the spline functions `ns', `bs'
        and so on are not included in the distribution.  A
        package containing these functions can use `pro-
        vide(splines)' to register this fact.  Another package
        that needs the functions can execute `require(splines)'
        rather than `library(splines)' to load the spline pack-
        age only if their functionality is not already avail-
        able.

        If `library' is called with no argument, it gives a
        list of all available packages.  `library(help = name)'
        prints information on the package `name', typically by
        listing the most important user level objects it con-
        tains.

        `library.dynam' loads the specified (shared) object
        file if it has not been loaded already.  It is designed
        to be used inside a package rather than at the command
        line.  The system-specific extension for shared
        libraries (e.g., ``.so'' on Unix systems) should not be
        added.

        `.packages()' returns the ``base names'' of the cur-
        rently attached packages.

        `.Library' is a character string giving the location of
        the default library, the ``library'' subdirectory of
        `RHOME'.  `.lib.loc' is a character vector with the
        locations of all library trees that should use.  It is
        initialized at startup from the environment variable
        `RLIBS', which should be a colon-separated list of
        directories at which library trees are rooted, and
        `.Library'.

   VVaalluuee::

        `library' returns the list of loaded packages (or
        `TRUE' if `logical.return' is `TRUE').  `require'
        returns a logical indicating whether the required pack-
        age is available.

   CCrreeaattiinngg PPaacckkaaggeess::

        Packages provide a mechanism for loading optional code
        and its documentation as needed.  The distribution pro-
        vides the two example packages `eda' and `mva'.

        A package consists of a subdirectory containing a
        `TITLE' and `INDEX' file, and subdirectories `R', `man'
        and optionally `src', `src-c', `data', and `exec'.

        The `TITLE' file contains a line giving the name of the
        package and a brief description.  `INDEX' contains a
        line for each sufficiently interesting object in the
        package, giving its name and a description (functions
        such as print methods not usually called explicitly
        might not be included).

        The `R' subdirectory contains code files with names
        beginning with lowercase letters.  One of these files
        should use `library.dynam()' to load any necessary com-
        piled code.

        The `man' subdirectory should contain documentation
        files for the objects in the package.

        Source and a Makefile for the compiled code is in
        `src', and a pure C version of the source should be in
        `src-c'.  In the common case when all the source is in
        C it may be convenient to make one of these directories
        a symbolic link to the other. The Makefile will be
        passed various machine-dependent compile and link
        flags, examples of which can be seen in the `eda' pack-
        age.

        The `data' subdirectory is for additional data files
        the package makes available for loading using `data()'.
        Note that (at least currently) all such files are in
        fact R code files, and must have the extension `.R'.

        Finally, `exec' could contain executables, typically
        (shell or Perl) scripts, the package needs.  Note that
        this mechanism currently only is experimental.

   IInnssttaalllliinngg aanndd RReemmoovviinngg PPaacckkaaggeess::

        To install a package, do `R INSTALL pkg', where `pkg'
        is the directory containing the package.  If you want
        to install into the library tree `lib' instead of the
        default one, use `R INSTALL pkg lib'.

        To remove the package `pkg' from the default library or
        the library `lib', do `R REMOVE pkg' or `R REMOVE pkg
        lib', respectively.

   SSeeee AAllssoo::

        `attach', `detach', `search', `objects', `autoload'.

   EExxaammpplleess::

        library()          # list all available packages
        library(lib = .Library)      # list all packages in the default library
        library(help = eda)     # documentation on package "eda"
        library(eda)            # load package "eda"
        require(eda)            # the same
        require(nonexistent)         # FALSE

