devtools (version 0.8)

load_all: Load complete package.

Description

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

Usage

load_all(pkg = ".", reset = FALSE, recompile = FALSE,
    export_all = TRUE)

Arguments

pkg
package description, can be path or package name. See as.package for more information
reset
clear package environment and reset file cache before loading any pieces of the package.
recompile
force a recompile of DLL from source code, if present.
export_all
If TRUE (the default), export all objects. If FALSE, export only the objects that are listed as exports in the NAMESPACE file.

Details

To unload and reload a package, use reset=TRUE. When reloading a package, A, that another package, B, depends on, load_all might not be able to cleanly unload and reload A. If this causes problems, try using unloading package B with unload before using load_all on A.

Support for packages with compiled C/C++/Fortran code in the /src/ directory is experimental. See compile_dll for more information about compiling code.

The namespace environment , is a child of the imports environment, which has the name attribute imports:pkgname. It is in turn is a child of , which is a child of the global environment.

The package environment 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=TRUE. This more closely simulates behavior when loading an installed package with library, and can be useful for checking for missing exports.

See Also

unload

compile_dll

clean_dll

Examples

Run this code
# Load the package in the current directory
load_all("./")

# Running again loads changed files
load_all("./")

# With reset=TRUE, unload and reload the package for a clean start
load_all("./", TRUE)

# With export_all=FALSE, only objects listed as exports in NAMESPACE
# are exported
load_all("./", export_all = FALSE)

Run the code above in your browser using DataCamp Workspace