View source: R/package-extra.R
setPackageExtraHandler | R Documentation |
These functions define a framework to register actions for which default sets of arguments can be defined when (lazy-)loading a package, and run later on, e.g., after the package is installed using dedicated commands.
setPackageExtraHandler
defines main action handler functions, for which
actions are defined as a set of arguments and registered using setPackageExtra
.
setPackageExtraHandler(handler, fun, ...)
packageExtraHandler(handler = NULL, ...)
setPackageExtra(handler, extra, ...)
packageExtra(handler = NULL, extra = NULL, package = NULL, .wrap = FALSE)
packageExtraRunner(handler)
install.extras(
package,
extra = NULL,
handler = NULL,
...,
.verbose = getOption("verbose")
)
install.extrapackages(
package,
extra = NULL,
handler = NULL,
...,
.verbose = getOption("verbose")
)
handler |
name of a handler, e.g, |
fun |
handler function that will be called with the arguments registered
with |
... |
extra arguments passed to internal function calls.
In In |
extra |
name of the extra action. |
package |
package name where to store/look for the internal registries. End users should not need to use this argument. |
.wrap |
logical that indicates if a function that runs the extra action should be returned or only the default arguments |
.verbose |
logical that indicates if verbose messages about the extra actions being run should be displayed. |
the runner function associated with the newly registered handler,
as built by packageExtraRunner
.
packageExtraHandler()
: retrieves a given handler from the registry.
setPackageExtra()
: registers extra actions for a given handler.
For example, calling setPackageExtra('install', pkgs='non_CRAN_pkg', repos='http://non-standard-repo')
in a source file of package 'myPkg' registers the call
install.packages('non_CRAN_pkg', repos='http://non-standard-repo', ...)
in a registry internal to the package.
All calls to setPackageExtra('install', ...)
can then be run by the user, as
a post installation step via install.extrapackages('myPkg', ..)
.
packageExtra()
: retrieve a given extra action, either as its registry entry,
or as a function that would perform the given action.
packageExtraRunner()
: defines a function to run all or some of the actions registered
for a given handler in a given package.
For example, the function install.extrapackages
is the runner defined for the extra handler 'install'
via packageExtraRunner('install')
.
install.extras()
: runs all extra actions registered for a given package.
install.extrapackages()
: install sets of packages that can enhance a
package, but may not be available from CRAN.
It is defined as the extra handler for
the extra action handler 'install.packages'
.
All arguments in ...
are passed to install.packages
.
By default, packages that are already installed are not re-installed.
An extra argument force
allows to force their installation.
The packages are loaded if their installation is successful.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.