load_all: Load complete package.

Description Usage Arguments Details Namespaces Shim files

View source: R/pkgload.R

Description

load_all loads a package. It roughly simulates what happens when a package is installed and loaded with library().

Usage

1
2
load_all(path = ".", reset = TRUE, recompile = FALSE, export_all = TRUE,
  helpers = TRUE, quiet = FALSE, ...)

Arguments

path

Path to a package, or within a package.

reset

clear package environment and reset file cache before loading any pieces of the package. This is equivalent to running unload() and is the default. Use reset = FALSE may be faster for large code bases, but is a significantly less accurate approximation.

recompile

force a recompile of DLL from source code, if present. This is equivalent to running pkgbuild::clean_dll() before load_all

export_all

If TRUE (the default), export all objects. If FALSE, export only the objects that are listed as exports in the NAMESPACE file.

helpers

if TRUE loads testthat test helpers.

quiet

if TRUE suppresses output from this function.

...

Additional arguments passed to [pkgload::load].

Details

Currently load_all:

Namespaces

The namespace environment <namespace:pkgname>, is a child of the imports environment, which has the name attribute imports:pkgname. It is in turn is a child of <namespace:base>, which is a child of the global environment. (There is also a copy of the base namespace that is a child of the empty environment.)

The package environment <package:pkgname> is an ancestor of the global environment. Normally when loading a package, the objects listed as exports in the NAMESPACE file are copied from the namespace to the package environment. However, load_all by default will copy all objects (not just the ones listed as exports) to the package environment. This is useful during development because it makes all objects easy to access.

To export only the objects listed as exports, use export_all=FALSE. This more closely simulates behavior when loading an installed package with library(), and can be useful for checking for missing exports.

Shim files

load_all also inserts shim functions into the imports environment of the loaded package. It presently adds a replacement version of system.file which returns different paths from base::system.file. This is needed because installed and uninstalled package sources have different directory structures. Note that this is not a perfect replacement for base::system.file.


hadley/devtools documentation built on July 13, 2018, 9:13 a.m.