因此,我有一个简单的闪亮应用程序,可以从数据库下载数据集并进行更改。而且由于下载和更改数据集需要一段时间,因此我想添加一个进度条,但问题是当下载快要完成时出现服务器错误。 这是我的应用程序:
ui <- fluidPage(
titlePanel("Downloading Dataframe with specimen + sequence data from BOLD / WorMs"),
textInput(inputId="taxa",
label="Enter the name of the taxon:",placeholder="Example: Cetacea"),
downloadButton("downloadData","Download")
)
server <- function(input, output){
taxaInput <- reactive({grades(input$taxa)})
output$downloadData <- downloadHandler(
filename = function() {
paste(input$taxa, ".tsv",sep="/t")
},
content = function(file) {
shiny::withProgress(
message=paste0("Downloading and annotating dataset for ",input$taxa),
value=0,
{
shiny::incProgress(1/10)
Sys.sleep(1)
shiny::incProgress(3/10)
Sys.sleep(1)
shiny::incProgress(5/10)
Sys.sleep(1)
shiny::incProgress(7/10)
Sys.sleep(1)
shiny::incProgress(7/10)
write_tsv(taxaInput(), file)
}
)
}
)
}
shinyApp(ui=ui,server=server)
是否有任何方法可以改进代码以使其完全发挥作用?提前非常感谢