local_variables: "Variable generating" functions

Description Usage Arguments Value Examples

View source: R/utilities.R

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

1
2
3
4
5
6
7

Arguments

env

Parent environment

localVars

Result of function call exporting an environment

Value

Named vector of created local variables

The updated environment

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
myVariableGeneratingFunction <- function()
{
  x <- 1
  y <- 2
  local_variables()
}
myMainFunction <- function()
{
  source_variables(myVariableGeneratingFunction())
  print(c(x, y))
}

tidytidbits documentation built on March 8, 2021, 5:07 p.m.