R: Install an expression as a function

installExprFunction {shiny} | R Documentation

## Install an expression as a function

### Description

Installs an expression in the given environment as a function, and registers debug hooks so that breakpoints may be set in the function.

### Usage

    installExprFunction(expr, name, eval.env = parent.frame(2), quoted = FALSE,
      assign.env = parent.frame(1), label = deparse(sys.call(-1)[[1]]),
      wrappedWithLabel = TRUE, ..stacktraceon = FALSE)

### Arguments

`expr` | A quoted or unquoted expression
`name` | The name the function should be given
`eval.env` | The desired environment for the function. Defaults to the calling environment two steps back.
`quoted` | Is the expression quoted?
`assign.env` | The environment in which the function should be assigned.
`label` | A label for the object to be shown in the debugger. Defaults to the name of the calling function.
`wrappedWithLabel, ..stacktraceon` | Advanced use only. For stack manipulation purposes; see `stacktrace`.

### Details

This function can replace `exprToFunction` as follows: we may use `func <- exprToFunction(expr)` if we do not want the debug hooks, or `installExprFunction(expr, "func")` if we do. Both approaches create a function named `func` in the current environment.

### See Also

Wraps `exprToFunction`; see that method's documentation for more documentation and examples.

[Package shiny version 1.0.3 Index]