在 Shiny App 中训练模型时显示加载标志

在 Shiny App 中训练模型时显示加载标志

问题描述:

我正在制作一个 Shiny 应用程序,在该应用程序中,通过单击 actionButton,使用 caret 包训练模型.由于此训练需要时间 - 大约 4-5 分钟 - 我想在应用程序中显示加载标志或加载 GIF,在模型训练后显示结果.否则,用户将不知道发生了什么或何时训练模型.

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.

谢谢

可以在 ui.R 中使用加载微调器

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")) 

您可以在 https://cran 上找到有关它的更多信息.r-project.org/web/packages/shinycssloaders/README.html