有没有办法在pblapply函数中插入闪亮的进度函数(incProgress),以便它可以在右上角显示百分比的进度。 IncProgress(...)需要每次lapply函数重新开始时进行评估,就像在基于文本的进度条中一样,在控制台中更新。
这是我的测试示例:
这是我的测试示例:
runApp(list(
ui = shinyUI(
fluidPage(
actionButton("calc","Start calculation"),
dataTableOutput("out")
)
),
server = shinyServer(function(session, input, output) {
library(pbapply)
#create list
n <- 100; nn <- 1000
g <- factor(round(n * runif(n * nn)))
x <- rnorm(n * nn) + sqrt(as.numeric(g))
xg <- split(x, g)
observeEvent(input$calc > 0,{
withProgress(message = "Initializing data manipulation process", value=0, {
list = pblapply(xg,mean)
#insert 'incProgress(percentage, detail = paste0("Progress: ",percentage)' in the pbapply or txtProgress function
})
output$out = renderDataTable(datatable(as.data.frame(unlist(list))))
})
})
)
)