问题
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
回答1:
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
回答2:
You can make a progress bar. Examples are here:
https://shiny.rstudio.com/articles/progress.html
来源:https://stackoverflow.com/questions/46596996/display-a-loading-sign-while-a-model-is-being-trained-in-shiny-app