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

Abd*_*han 4 r shiny r-caret shinydashboard

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

谢谢

San*_*osh 6

你可以在你的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")) 
Run Code Online (Sandbox Code Playgroud)

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