expose | R Documentation |
Use expose
to copy the exported member of a module to the calling
environment. This is useful for a simple reexport of member functions and
generally for object composition.
expose(module, ..., reInit = TRUE, where = parent.frame())
module |
(character | module) a module as file or folder name or a list representing a module. |
... |
(character, or unquoted expression) elements to be exposed. Defaults to all. |
reInit |
(logical) whether to re-initialize module. This is only relevant if a module has state which can be changed. This argument is passed to as.module. |
where |
(environment) typically the calling environment. Should only be relevant for testing. |
You call this function for its side effects. It is a variation of use where instead of returning a module as return value, the elements are copied to the calling environment.
m1 <- module({
foo <- function() "foo"
})
m2 <- module({
bar <- function() "bar"
})
# Now we create a module with 'foo' and 'bar' as member functions.
m3 <- module({
expose(m1)
expose(m2)
})
m3$foo()
m3$bar()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.