# exprToFunction

0th

Percentile

##### Convert an expression to a function

This is to be called from another function, because it will attempt to get an unquoted expression from two calls back.

##### Usage
exprToFunction(expr, env = parent.frame(2), quoted = FALSE,
caller_offset = 1)
##### Arguments
expr
A quoted or unquoted expression, or a function.
env
The desired environment for the function. Defaults to the calling environment two steps back.
quoted
Is the expression quoted?
caller_offset
If specified, the offset in the callstack of the functiont to be treated as the caller.
##### Details

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.

##### Aliases
• exprToFunction
##### Examples
# 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")

# Create an output object
output$tripleA <- renderTriple({ values$A
})

# At the R console, you can experiment with the renderer using isolate()
tripleA <- renderTriple({
values\$A
})

isolate(tripleA())
# "text, text, text"
Documentation reproduced from package shiny, version 0.12.2, License: GPL-3 | file LICENSE

### Community examples

Looks like there are no examples yet.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.48188331723213196, "perplexity": 13848.00190636045}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-51/segments/1575541288287.53/warc/CC-MAIN-20191214174719-20191214202719-00179.warc.gz"}