You can declare imports similar to what we would do in a R package: we list complete packages or single function names from a package. These listed imports are made available inside the module scope.
1 2 3
(character, or unquoted expression) a package name
(character, or unquoted expression) names to import from package.
(logical) whether to attach the imports to the search path.
(environment) typically the calling environment. Should only be relevant for testing.
(character | NULL) a character vactor excluding any packages from being imported.
import and use can replace library and attach.
However they behave differently and are only designed to be used within
modules. Both will work when called in the
.GlobalEnv but here they
should only be used for development and debugging of modules.
import adds a layer to a local search path. More precisely to the
calling environment, which is the environment supplied by
It will alter the state of the calling environment. This is very
similar to how the library function and the search path are
constructed in base R. Noticeable differences are that we can choose to
only import particular functions instead of complete packages. Further we
do not have to mutate the calling environment by setting attach to
FALSE. Regardless of the
return an environment with the imports and can be bound to a name.
library will also load packages in the 'Depends' field of a package,
this is something
import will not do.
import declaration per package is allowed. A second call to
import will remove the previous one from the search path. Then the new
import layer is added. If several smaller import declarations are
attach = FALSE and bind the return value of
import to a name.
An environment is returned invisibly comprising the imports.
1 2 3 4 5 6 7 8 9
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.