[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to combine 'foreach' with "shinybusy"? #40

Open
HuidongTian opened this issue Mar 9, 2023 · 0 comments
Open

How to combine 'foreach' with "shinybusy"? #40

HuidongTian opened this issue Mar 9, 2023 · 0 comments

Comments

@HuidongTian
Copy link

Hi, thanks for creating this excellent package!

I want to add a progress bar for "foreach" progress for my shiny-app. However, the progress bar stopped (at around 88%) before reaching to the end. I couldn't figure out why this issue happened, could you help?
The following is a demo of the issue:
`
library(shiny)
library(shinybusy)
library(doParallel); registerDoParallel(cores = 4)

n <- 100
f <- function(n){
m <- 0
function(...) {
m <<- m + length(list(...)) - 1
Sys.sleep(0.1)
update_modal_progress(value = m/n)
}
}

ui <- fluidPage(
tags$h1("Modal with progress bar"),
actionButton("sleep1", "Launch a long calculation")
)

server <- function(input, output, session) {
observeEvent(input$sleep1, {
show_modal_progress_line()
result <- foreach(i = 1:n, .combine = f(n)) %dopar% {
rnorm(10)
}
remove_modal_progress()
})

}

shinyApp(ui, server)
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant