local_variables | R Documentation |
A pair of functions that allows a "variable generating" function and read this function's local vars into the environment of the caller.
local_variables(env = parent.frame()) localVariables(env = parent.frame()) source_variables(localVars) sourceVariables(localVars)
env |
Parent environment |
localVars |
Result of function call exporting an environment |
Named vector of created local variables
The updated environment
myVariableGeneratingFunction <- function() { x <- 1 y <- 2 local_variables() } myMainFunction <- function() { source_variables(myVariableGeneratingFunction()) print(c(x, y)) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.