I have noticed some strange behavior when using Windows progress bars in RStudio vs. Base R. Specifically, RStudio creates a progress bar in its own window (standalone in the taskbar), while Base R creates a progress bar in an "R window" (grouped together with R in the taskbar). See screenshot below for example.
For my purposes, this becomes an issue when using Shiny applications because my progress bars do not pop up in front of the browser when using Base R (the user needs to click over to the R window in order to see them - see screenshot), while they do pop up as desired when running the exact same code in RStudio.
Is there a way to change the behavior of progress bars in Base R to match the desired behavior in RStudio? I have tried looking through options()
but couldn't find anything about progress bars.
Here's a toy example using Shiny if you want to try it out:
# Simple progress bar app
require(shiny)
runApp(list(
ui = bootstrapPage(
actionButton("goButton", "Go!")
),
server = function(input, output) {
observe({
if(input$goButton > 0) {
pb = winProgressBar("test progress bar", "Some information in %",0, 100, 0)
u = c(0, sort(runif(20, 0, 100)), 100)
for(i in u) {
Sys.sleep(0.1)
info <- sprintf("%d%% done", round(i))
setWinProgressBar(pb, i, "test progress bar", info)
}
Sys.sleep(2)
close(pb)
}
})
}
))