Display a Loading Sign while a model is being trained in Shiny App

Viewed 4722

I am making a Shiny App in which, at the click of the actionButton, a model is trained using the caret package. As this training takes time - approximately 4-5 minutes - I wanted to display a loading sign or a loading GIF in the App where results are displayed after the model is trained. Otherwise, the User wouldn't know what is happening or when the model is trained.

Thanks

2 Answers

There is loading spinner which you can use in your ui.R

# loading the library
library(shinycssloaders)
withSpinner()

# For example, if you have the plot for which you would like to show loading spinner before it's gets drawn while making some data manipulation 
withSpinner(plotOutput("my_plot")) 

You can find more information about it on https://cran.r-project.org/web/packages/shinycssloaders/README.html

Related