EVOLUTION-MANAGER
Edit File: withProgress.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: Reporting progress (functional API)</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 withProgress {shiny}"><tr><td>withProgress {shiny}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Reporting progress (functional API)</h2> <h3>Description</h3> <p>Reports progress to the user during long-running operations. </p> <h3>Usage</h3> <pre> withProgress( expr, min = 0, max = 1, value = min + (max - min) * 0.1, message = NULL, detail = NULL, style = getShinyOption("progress.style", default = "notification"), session = getDefaultReactiveDomain(), env = parent.frame(), quoted = FALSE ) setProgress( value = NULL, message = NULL, detail = NULL, session = getDefaultReactiveDomain() ) incProgress( amount = 0.1, message = NULL, detail = NULL, session = getDefaultReactiveDomain() ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>expr</code></td> <td> <p>The work to be done. This expression should contain calls to <code>setProgress</code>.</p> </td></tr> <tr valign="top"><td><code>min</code></td> <td> <p>The value that represents the starting point of the progress bar. Must be less tham <code>max</code>. Default is 0.</p> </td></tr> <tr valign="top"><td><code>max</code></td> <td> <p>The value that represents the end of the progress bar. Must be greater than <code>min</code>. Default is 1.</p> </td></tr> <tr valign="top"><td><code>value</code></td> <td> <p>Single-element numeric vector; the value at which to set the progress bar, relative to <code>min</code> and <code>max</code>.</p> </td></tr> <tr valign="top"><td><code>message</code></td> <td> <p>A single-element character vector; the message to be displayed to the user, or <code>NULL</code> to hide the current message (if any).</p> </td></tr> <tr valign="top"><td><code>detail</code></td> <td> <p>A single-element character vector; the detail message to be displayed to the user, or <code>NULL</code> to hide the current detail message (if any). The detail message will be shown with a de-emphasized appearance relative to <code>message</code>.</p> </td></tr> <tr valign="top"><td><code>style</code></td> <td> <p>Progress display style. If <code>"notification"</code> (the default), the progress indicator will show using Shiny's notification API. If <code>"old"</code>, use the same HTML and CSS used in Shiny 0.13.2 and below (this is for backward-compatibility).</p> </td></tr> <tr valign="top"><td><code>session</code></td> <td> <p>The Shiny session object, as provided by <code>shinyServer</code> to the server function. The default is to automatically find the session by using the current reactive domain.</p> </td></tr> <tr valign="top"><td><code>env</code></td> <td> <p>The environment in which <code>expr</code> should be evaluated.</p> </td></tr> <tr valign="top"><td><code>quoted</code></td> <td> <p>Whether <code>expr</code> is a quoted expression (this is not common).</p> </td></tr> <tr valign="top"><td><code>amount</code></td> <td> <p>For <code>incProgress</code>, the amount to increment the status bar. Default is 0.1.</p> </td></tr> </table> <h3>Details</h3> <p>This package exposes two distinct programming APIs for working with progress. Using <code>withProgress</code> with <code>incProgress</code> or <code>setProgress</code> provide a simple function-based interface, while the <code><a href="Progress.html">Progress()</a></code> reference class provides an object-oriented API. </p> <p>Use <code>withProgress</code> to wrap the scope of your work; doing so will cause a new progress panel to be created, and it will be displayed the first time <code>incProgress</code> or <code>setProgress</code> are called. When <code>withProgress</code> exits, the corresponding progress panel will be removed. </p> <p>The <code>incProgress</code> function increments the status bar by a specified amount, whereas the <code>setProgress</code> function sets it to a specific value, and can also set the text displayed. </p> <p>Generally, <code>withProgress</code>/<code>incProgress</code>/<code>setProgress</code> should be sufficient; the exception is if the work to be done is asynchronous (this is not common) or otherwise cannot be encapsulated by a single scope. In that case, you can use the <code>Progress</code> reference class. </p> <p>As of version 0.14, the progress indicators use Shiny's new notification API. If you want to use the old styling (for example, you may have used customized CSS), you can use <code>style="old"</code> each time you call <code>withProgress()</code>. If you don't want to set the style each time <code>withProgress</code> is called, you can instead call <code><a href="shinyOptions.html">shinyOptions(progress.style="old")</a></code> just once, inside the server function. </p> <h3>See Also</h3> <p><code><a href="Progress.html">Progress()</a></code> </p> <h3>Examples</h3> <pre> ## Only run examples in interactive R sessions if (interactive()) { options(device.ask.default = FALSE) ui <- fluidPage( plotOutput("plot") ) server <- function(input, output) { output$plot <- renderPlot({ withProgress(message = 'Calculation in progress', detail = 'This may take a while...', value = 0, { for (i in 1:15) { incProgress(1/15) Sys.sleep(0.25) } }) plot(cars) }) } shinyApp(ui, server) } </pre> <hr /><div style="text-align: center;">[Package <em>shiny</em> version 1.5.0 <a href="00Index.html">Index</a>]</div> </body></html>