library(package, help, pos = 2, lib.loc = NULL, character.only = FALSE, logical.return = FALSE, warn.conflicts = TRUE, quietly = FALSE, keep.source = getOption("keep.source.pkgs"), verbose = getOption("verbose"))require(package, lib.loc = NULL, quietly = FALSE, warn.conflicts = TRUE, keep.source = getOption("keep.source.pkgs"), character.only = FALSE)
# the following are for package writers only .onLoad(lib.loc, package) .onAttach(lib.loc, package) .onUnload(packagePath)
package | a character string or name giving the name of the package. The package must be a valid package. If omitted, The engine returns a help message describing the libraries in lib.loc. (See Value for more information.) |
help | a character string or name of a package for which help is sought. In most cases, this string gives a list of objects in the package, along with brief descriptions. After you attach a package, you can use thehelp function directly to see documentation on particular objects. |
pos | an integer or a string. The position in the search list the package should occupy. The packages originally in position pos or above are moved down the list. Alternatively, the position can be given as the name in the search list, such as "package:base". The new package is inserted at the position of the specified package, and the package is moved down the list. |
lib.loc | a character vector containing the names of library directories in which to search for package. If lib.loc is NULL, .libPaths() is used. It is not used when searching for packages listed in the "Depends:" section of packageDescription(package) but it is temporary added to the front of the list returned by .libPaths() while searching for packages listed in the "Imports:" section. |
character.only | a logical value. If FALSE (the default), library(package) (without quotes) is equivalent to library("package"). If TRUE, package is expected to be the name of a variable containing a character string. (This also applies to the help argument.) |
logical.return |
a logical value.
|
warn.conflicts | a logical value. If TRUE (the default), it displays a warning if the objects or functions in the package mask any of the packages already loaded. If FALSE, no check is performed. |
quietly | a logical value. If TRUE, no message is displayed to say a required package is being loaded. The default is FALSE: such a message will be printed. |
keep.source | a logical value indicating if source code including comments are kept. Used by loadNamespace and sys.source functions. |
verbose |
a logical value. If it is TRUE, it displays warnings under the following
conditions:
|
library | returns the following:
|
require | returns (invisibly) a logical value to indicate whether the required package is available. |
## Not run: if(require(somePackage, quietly=TRUE)) { somePackage::functionInSomePackage() } else { message("'somePackage' is not available, will work around it absence") } library() ## End(Not run)