Institute a module object inline or from a file. mod::ule() is a useful shorthand for module() when this package is not attached.
module(..., parent = parent.frame(), lock = TRUE) ule(..., parent = parent.frame(), lock = TRUE) acquire(path, parent = baseenv(), lock = TRUE)
... | module expression |
---|---|
parent | the enclosing environment |
lock | lock the environment; logical |
path | path to a module file |
an environment
of class module
containing defined objects
# from file module_path <- system.file("misc", "example_module.R", package = "mod") example_module <- acquire(module_path) example_module$e(123)#> [1] 129#> [1] 1my_module$f#> function () #> { #> .a #> } #> <environment: 0x000000002b461fa8>