load_all loads a package. It roughly simulates what happens
when a package is installed and loaded with
load_all( path = ".", reset = TRUE, recompile = FALSE, export_all = TRUE, helpers = TRUE, quiet = FALSE, ... )
Path to a package, or within a package.
clear package environment and reset file cache before loading
any pieces of the package. This largely equivalent to running
DEPRECATED. force a recompile of DLL from source code, if
present. This is equivalent to running
Additional arguments passed to
Loads all data files in
load_data() for more
Sources all R files in the R directory, storing results in
environment that behaves like a regular package namespace. See
load_code() for more details.
Compiles any C, C++, or Fortran code in the
src/ directory and
connects the generated DLL into R. See
for more details.
Loads any compiled translations in
.onUnload() functions at
the correct times.
If you use testthat, will load all test helpers so you can
access them interactively. devtools sets the
environment variable to
"true" to let you check whether the
helpers are run during package loading.
TRUE when it is called while
is running. This may be useful e.g. in onLoad hooks.
load_all() tries its best to reproduce the behaviour of
library(). However it deviates from normal
package loading in several ways.
It doesn't install the package on disk, so
system.file() has no
way of determining the location of the development files. To work
around this, pkgload installs its own version of
on the search path to make it easier to use interactively while
developing. However this definition is only visible to the global
environment, not to the namespaces of third party packages.
One workaround for other packages to see the development files of
your package while you're developing with devtools is for them to
fs::path_package() instead of
library() only load package
dependencies when they are needed,
load_all() loads all packages
Imports at load time.
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
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.
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
## Not run: # 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) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.