Learn R Programming

Rcpp (version 0.9.15)

loadModule: Load an Rcpp Module into a Package

Description

One or more calls to loadModule will be included in the source code for a package to load modules and optionally expose objects from them. The actual extraction of the module takes place at load time.

Usage

loadModule(module, what = , loadNow, env =)

Arguments

module
The name of the C++ module to load. The code for the module should be in the same package as the R

Value

  • If the load takes place, the module environment is returned. Usually however the function is called for its side effects.

item

  • what
  • loadNow, env

Details

If the purpose of loading the module is to define classes based on C++ classes, see setRcppClass(), which does the necessary module loading for you.

When the module can be started (at namespace load time), the function Module() returns an environment with a description of the module's contents. Function loadModule() saves this as a metadata object in the package namespace. Therefore multiple calls to loadModule() are an efficient way to extract different objects from the module.

Requesting an object that does not exist in the module produces a warning.

Since assignments from the call cannot take place until namespace loading time, any computations using the objects must also be postponed until this time. Use load actions (setLoadAction) and make sure that the load action is specified after the call to loadModule().

See Also

setRcppClass() to avoid the explicit call.

loadRcppModules() for a shotgun procedure to load all modules.

Examples

Run this code
loadModule("yada", TRUE) # load all the objects from module "yada"

Run the code above in your browser using DataLab