withProgress function - Multiple bars

Hello...
I'd like to know if is possible to render at the same time multiple bars using this function 'withProgress' associated to 'incProgress'....How can I do that ? Could somebody show me an example ?
Thanks


library(shiny)

ui <- fluidPage(
  actionButton("start","start"),
  tableOutput("t1")
)

server <- function(input, output, session) {
 
  output$t1 <- renderTable({
    req(input$start)
    withProgress(message = 'Outer Calculation in progress',
                 detail = 'This may take a while...', value = 0, {
                   for (i in 1:2) {
                     withProgress(message = 'Inner Calculation in progress',
                                  detail = 'This may take a while...', value = 0, {
                                    for (i in 1:10) {
                                      incProgress(1/10)
                                      Sys.sleep(0.05)
                                    } 
                                  })
                     incProgress(1/2)
                     Sys.sleep(0.25)
                   } 
                 })
    data.frame(x=1)
    
  })
  
}

shinyApp(ui, server)

Thanks, man....just one question: Following this example, the incProgress function goes only inside "Inner Calculation" or it is possible inside "Outer Calculation" as well ?

Look again. Its there at both levels

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.