rmarkdown (version 1.1)

render_delayed: Delay Rendering for an Expression

Description

In a Shiny document, evaluate the given expression after the document has finished rendering, instead of during render.

Usage

render_delayed(expr)

Arguments

expr
The expression to evaluate.

Value

An object representing the expression.

Details

This function is useful inside Shiny documents. It delays the evaluation of its argument until the document has finished its initial render, so that the document can be viewed before the calculation is finished.

Any expression that returns HTML can be wrapped in render_delayed.

Examples

Run this code
## Not run: 
# 
# # Add the following code to an R Markdown document
# 
# div(Sys.time())
# 
# render_delayed({
#  Sys.sleep(3)      # simulate an expensive computation
#  div(Sys.time())
# })
# 
# div(Sys.time())
# ## End(Not run)

Run the code above in your browser using DataCamp Workspace