pkg_load {srcpkgs} | R Documentation |
loads or reloads if needed a source package, taking care of its dependencies
Description
N.B: the defaults are different from devtools::load_all()
: the helpers are not loaded, only
the functions tagged as exported are actually exported. The intended goal is to make it as similar
to the behaviour of the R loaders.
Usage
pkg_load(
pkgid,
src_pkgs = get_srcpkgs(),
attach = TRUE,
suggests = FALSE,
roxygen = TRUE,
helpers = FALSE,
export_all = FALSE,
quiet = FALSE,
dry_run = FALSE,
...
)
Arguments
pkgid |
a package name, path or object |
src_pkgs |
a collection of source packages as a |
attach |
Whether to attach a package environment to the search
path. If |
suggests |
whether to load suggested packages. if TRUE, the suggested are processed like imports |
roxygen |
whether to automatically roxygenise packages (if needed) |
helpers |
if |
export_all |
If |
quiet |
whether to be quiet/silent |
dry_run |
whether not to actually execute any action having side-effects |
... |
Arguments passed on to
|
Details
This the workhorse function of the package, called by library()
and loadNamespace()
when hacked (cf hack_r_loaders()
.
This function will check that all dependent packages are up-to-date, and document and reload them as needed.
To be able to properly load a package, its dependent source packages must be loaded in proper order. i.e. if A–>B–>C, the load order must be C, B, A
Value
the load plan as a data frame, or NULL if there is nothing to do.
Examples
## Not run:
# load and attach a package
pkg_load('mypkg')
# just load, do not attach it (~ loadNamespace())
pkg_load('mypkg', attach = FALSE)
# do some changed, to a source package or any of its depencies or dependents
plan <- pkg_load('mypkg', dry_run = TRUE)
# then you can inspect the plan actions
## End(Not run)