Set incProgress() automatically on shiny?

Hello, I'm really struggling to understand how to increment the progress bar using withProgress(). How do I get the exactely time needed to complete my task and sync it to the bar progress?

Consider this example on exporting a SVM Model, it may take a while, how do I set the incprogress ? Actually its stucking at more or less 10% of its size and then it closes when the task is finished.

output$download_SV <- downloadHandler(
                
                filename = function() {
                  "modelo_svm_reg.rds"
                },
                content = function(fname) {
                  withProgress(message = 'Exporting model, please wait ...', {
                  incProgress(?)
                  saveRDS(fit_SV(), fname)
                  })
                }
              )

You can try to break it up a little bit.

withProgress(
  message = 'Exporting model, please wait ...', 
  {
    incProgress(0.5, "fitting model")
    model <- fit_SV()

    incProgress(0.5, "saving model")
    saveRDS(model, fname)
  }
)

I'm guessing it's fitting the model that takes a while. Saving the file to an RDS file should be quick. If there is any way to allow for fit_SV to call setProgress, it might help out what is going on within the model fitting process.

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