library
Loading Packages with registering symbols for TeX package 'listing'
library
and require
load add-on packages.
In the masked versions of package
- Keywords
- utilities
Usage
library(package, help, pos = 2, lib.loc = NULL,
character.only = FALSE, logical.return = FALSE,
warn.conflicts = TRUE,
keep.source = getOption("keep.source.pkgs"),
verbose = getOption("verbose"),
version, inSweave,
keywordstyles, interm.keywordstyles, overwrite, intermediate)
require(package, lib.loc = NULL, quietly = FALSE,
warn.conflicts = TRUE,
keep.source = getOption("keep.source.pkgs"),
character.only = FALSE, version, save = TRUE, inSweave,
keywordstyles, interm.keywordstyles, overwrite, intermediate)
Arguments
- package, help
- the name of a package, given as a name or
literal character string, or a character string, depending on
whether
character.only
isFALSE
(default) orTRUE
). - pos
- the position on the search list at which to attach the
loaded package. Note that
.First.lib
may attach other packages, andpos
is computed after.First.lib
has been run. Can also be the name - lib.loc
- a character vector describing the location of Rlibrary trees to search through, or
NULL
. The default value ofNULL
corresponds to all libraries currently known. Non-existent library trees are silently ignored. - character.only
- a logical indicating whether
package
orhelp
can be assumed to be character strings. - version
- A character string denoting a version number of the package to be loaded, for use with versioned installs: see the section later in this document.
- logical.return
- logical. If it is
TRUE
,FALSE
orTRUE
is returned to indicate success. - warn.conflicts
- logical. If
TRUE
, warnings are printed aboutconflicts
from attaching the new package, unless that package contains an object.conflicts.OK
. A conflict is a func - keep.source
- logical. If
TRUE
, functionskeep their source including comments, see argumentkeep.source
tooptions
. This applies only to the named package, and - verbose
- a logical. If
TRUE
, additional diagnostics are printed. - quietly
- a logical. If
TRUE
, no message confirming package loading is printed. - save
- logical or environment. If
TRUE
, a call torequire
from the source for a package will save the name of the required package in the variable".required"
, allowing function - inSweave
- shall the command show Sweave behaviour (no startup messages;
instead issuing new symbols for
morekeywords
tag in language definition of Rin TeX packagelistings )? By defau - keywordstyles
- character or missing or
NULL
; added argument in masked versions oflibrary
andrequire
of packageSweaveListingUtils ; if given, the keywordstyle to be used by TeX package 'listings' for the symbol - interm.keywordstyles
- character or missing or
NULL
; added argument in masked versions oflibrary
andrequire
of packageSweaveListingUtils ; if given, the keywordstyle to be used by TeX package 'listings' for the symbol - overwrite
- logical or missing or
NULL
; added argument in masked versions oflibrary
andrequire
of packageSweaveListingUtils ; if missing, the corresponding global option is read out by - intermediate
- logical or missing or
NULL
; added argument in masked versions oflibrary
andrequire
of packageSweaveListingUtils ; if missing, the corresponding global option is read out by
Details
library
and require
are masked versions of the original
versions in package keywordstyles
, interm.keywordstyles
,
overwrite
, intermediate
. Hence please confer
library
, require
.
If argument inSweave
is FALSE
or if argument
inSweave
is missing and the corresponding global
option getSweaveListingOption("inSweave")
is FALSE
,
then library
and require
behave exactly as the TRUE
,
the corresponding startup-messages are suppressed, and the TeX
code for registering all new symbols to be found with ls
as
morekeywords
for the Rlanguage definition in TeX package
keywordstyles
and
interm.keywordstyles
if missing is as follows: First we check whether
for the corresponding package, there is an enty in the global
option variable .tobeDefinedPkgs
(which is a matrix residing in the
package namespace with one column of package names and one column of
corresponding keywordstyle format strings)
and if so use its corresponding keywordstyle; else we use option
Keywordstyles
resp. interm.Keywordstyles
(which we get
by getSweaveListingOption
). New entries in the global variable
.tobeDefinedPkgs
may be appended by setToBeDefinedPkgs
.
The masked versions work as follows: first the call is written to an
object and split into a base::
where
is either
require
or library
. By noting the list of attached packages
before and after this call we also get hand on the intermediate packages,
which are automatically attached packages by dependence. After this call
we register the new symbols by corresponding calls to
lstsetLanguage
.
For use in an .Rnw
file, the call to require
or library
should be wrapped into a corresponding Sweave chunk in the form
<< /chunkname/, results=tex, echo=TRUE>>=
require( ..... )
@
,for example
<< distrRequire, results=tex, echo=TRUE>>=
require(distr)
@
Value
- as the unmasked versions.
See Also
Examples
require(survival)