Create a meta-reactive output that, when invoked with meta-mode activated (i.e. called within expandChain() or withMetaMode()), returns a code expression (instead of evaluating that expression and returning the value).

metaRender(
renderFunc,
expr,
...,
env = parent.frame(),
quoted = FALSE,
localize = "auto",
bindToReturn = FALSE
)

metaRender2(renderFunc, expr, ..., env = parent.frame(), quoted = FALSE)

## Arguments

renderFunc A reactive output function (e.g., shiny::renderPlot, shiny::renderText, shiny::renderUI, etc). An expression that generates given output expected by renderFunc. Other arguments passed along to renderFunc. The parent environment for the reactive expression. By default, this is the calling environment, the same as when defining an ordinary non-reactive expression. If x is a quosure and quoted is TRUE, then env is ignored. If it is TRUE, then the quote()ed value of x will be used when x is evaluated. If x is a quosure and you would like to use its expression as a value for x, then you must set quoted to TRUE. Whether or not to wrap the returned expression in local(). The default, "auto", only wraps expressions with a top-level return() statement (i.e., return statements in anonymized functions are ignored). For non-localized expressions, should an assignment of a meta expression be applied to the last child of the top-level \{ call?

## Value

An annotated render function, ready to be assigned to an output slot. The function may also be called in meta mode (i.e., inside expandChain()) to return the code in quoted form.

## Details

If you wish to capture specific code inside of expr (e.g. ignore code that has no meaning outside shiny, like req()), use metaRender2() in combination with metaExpr(). When using metaRender2(), expr must return a metaExpr().

Since package authors are allowed to create their own output rendering functions, creating a meta-counterpart of an output renderer (e.g. renderPlot()) needs to be more general than prefixing meta to the function name (as with metaReactive() and metaObserve()). metaRender() makes some assumptions about the arguments taken by the render function, assumptions that we believe are true for all existing render functions. If you encounter a render function that doesn't seem to work properly, please let us know by filing an issue on GitHub.

metaExpr(), ..

## Examples


if (interactive()) {
library(shiny)
library(shinymeta)

ui <- fluidPage(
selectInput("var", label = "Choose a variable", choices = names(cars)),
verbatimTextOutput("Summary"),
verbatimTextOutput("code")
)

server <- function(input, output) {
var <- metaReactive({
cars[[..(input$var)]] }) output$Summary <- metaRender(renderPrint, {
summary(..(var()))
})
output$code <- renderPrint({ expandChain(output$Summary())
})
}

shinyApp(ui, server)
}