EVOLUTION-MANAGER
Edit File: exprToFunction.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Convert an expression to a function</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for exprToFunction {shiny}"><tr><td>exprToFunction {shiny}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Convert an expression to a function</h2> <h3>Description</h3> <p>This is to be called from another function, because it will attempt to get an unquoted expression from two calls back. </p> <h3>Usage</h3> <pre> exprToFunction(expr, env = parent.frame(), quoted = FALSE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>expr</code></td> <td> <p>A quoted or unquoted expression, or a function.</p> </td></tr> <tr valign="top"><td><code>env</code></td> <td> <p>The desired environment for the function. Defaults to the calling environment two steps back.</p> </td></tr> <tr valign="top"><td><code>quoted</code></td> <td> <p>Is the expression quoted?</p> </td></tr> </table> <h3>Details</h3> <p>If expr is a quoted expression, then this just converts it to a function. If expr is a function, then this simply returns expr (and prints a deprecation message). If expr was a non-quoted expression from two calls back, then this will quote the original expression and convert it to a function. </p> <h3>Examples</h3> <pre> # Example of a new renderer, similar to renderText # This is something that toolkit authors will do renderTriple <- function(expr, env=parent.frame(), quoted=FALSE) { # Convert expr to a function func <- shiny::exprToFunction(expr, env, quoted) function() { value <- func() paste(rep(value, 3), collapse=", ") } } # Example of using the renderer. # This is something that app authors will do. values <- reactiveValues(A="text") ## Not run: # Create an output object output$tripleA <- renderTriple({ values$A }) ## End(Not run) # At the R console, you can experiment with the renderer using isolate() tripleA <- renderTriple({ values$A }) isolate(tripleA()) # "text, text, text" </pre> <hr /><div style="text-align: center;">[Package <em>shiny</em> version 1.5.0 <a href="00Index.html">Index</a>]</div> </body></html>