local_variables {tidytidbits} | R Documentation |
"Variable generating" functions
Description
A pair of functions that allows a "variable generating" function and read this function's local vars into the environment of the caller.
Usage
local_variables(env = parent.frame())
localVariables(env = parent.frame())
source_variables(localVars)
sourceVariables(localVars)
Arguments
env |
Parent environment |
localVars |
Result of function call exporting an environment |
Value
Named vector of created local variables
The updated environment
Examples
myVariableGeneratingFunction <- function()
{
x <- 1
y <- 2
local_variables()
}
myMainFunction <- function()
{
source_variables(myVariableGeneratingFunction())
print(c(x, y))
}
[Package tidytidbits version 0.3.2 Index]