Load a Package

DESCRIPTION:

Loads a S-PLUS package containing functions, data, documentation and compiled code. This function differs from library() by returning a value that indicates its success or failure, so that require can be used in other functions.

USAGE:

require(package, quietly=FALSE, warn.conflicts=TRUE, keep.source=getOption("keep.source.pkgs"), character.only=FALSE, version, save=TRUE)

REQUIRED ARGUMENTS:

package
the name of a package given as a character string or a name. If the argument character.only is FALSE (the default), then either type is okay, otherwise it must be a character string.

OPTIONAL ARGUMENTS:

quietly
a logical value. This argument is ignored.
warn.conflicts
a logical value. This argument is ignored.
keep.source
a logical value. This argument is ignored.
character.only
a logical value. If character.only is FALSE (the default) then require(mylib) (without quotes) is equivalent to require("mylib"). If character.only is TRUE then the package argument must be a character string or the name of a variable containing a character string.
version
a logical value. This argument is ignored.
save
a logical value. This argument is ignored.

VALUE:

Returns a logical value: TRUE if the package was successfully loaded; FALSE otherwise.

SIDE EFFECTS:

A package is loaded. Refer to for more information about side effects.

DETAILS:

require() calls library() to load a package, but instead of failing if the package cannot be loaded, require() returns a logical value and all errors appear as warnings.

This preliminary version of the function ignores most of the arguments and so does not include some of the functionality of R's version of require() .

No records are kept of 'required' libraries for use by detach.

SEE ALSO:

For more details, consult the help for .

EXAMPLES:

if (require(myPackage)) {
    # call functions or use data from myPackage
} else warning("myPackage is not available")