library

Loading Packages with registering symbols for TeX package 'listing'

library and require load add-on packages. In the masked versions of package SweaveListingUtils documented here, they also register corresponding symbols. Besides this registration, they behave identically to the original versions of package base. Hence much of this help is also just copied from the original help page.

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 is FALSE (default) or TRUE).
pos
the position on the search list at which to attach the loaded package. Note that .First.lib may attach other packages, and pos 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 of NULL corresponds to all libraries currently known. Non-existent library trees are silently ignored.
character.only
a logical indicating whether package or help 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 or TRUE is returned to indicate success.
warn.conflicts
logical. If TRUE, warnings are printed about conflicts from attaching the new package, unless that package contains an object .conflicts.OK. A conflict is a func
keep.source
logical. If TRUE, functions keep their source including comments, see argument keep.source to options. 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 to require 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 package listings)? By defau
keywordstyles
character or missing or NULL; added argument in masked versions of library and require of package SweaveListingUtils; 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 of library and require of package SweaveListingUtils; 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 of library and require of package SweaveListingUtils; if missing, the corresponding global option is read out by
intermediate
logical or missing or NULL; added argument in masked versions of library and require of package SweaveListingUtils; if missing, the corresponding global option is read out by
Details

library and require are masked versions of the original versions in package base. This masking is necessary to allow for extra arguments 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 base package versions; only if the effective argument is 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 listings is issued (and hence can be used in .Rnw files. The strategy to fill arguments 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-package-part and into the extra arguments mentioned above. Then we call 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

library.

Aliases
  • library
  • require
Examples
require(survival)
Documentation reproduced from package SweaveListingUtils, version 0.1.1, License: LGPL-3

Community examples

Looks like there are no examples yet.