You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In trying to demonstrate the functionality of my package to users, I want to make progress bars as invisible as possible. Yet, using the fantastic progressr implementation, I need to show users how to activate global handling of progress bars. But how can I do this in an R Markdown (Rmd) file for a vignette? Even this very minimal example crashes:
Error in globalCallingHandlers(condition = global_progression_handler) :
should not be called with handlers on the stack
3. globalCallingHandlers(condition = global_progression_handler)
2. register_global_progression_handler(action = action)
1. progressr::handlers(global = TRUE)
In the [progressr] package documentation, we are told "In such cases, the global progress handler has to be enabled prior to processing the document, e.g."
But how is that possible in standard package documentation? As far as I can tell, progressr::handlers(global = TRUE) is for interactive use. I do not see how a package developer can easily communicate this information to their package users. I would appreciate any help with this.
The text was updated successfully, but these errors were encountered:
This is a limitation in R that progressr cannot work around. It's possible that knitr can provide a workaround. I've posted "WISH: Make it possible to call globalCallingHandlers() in a chunk" (yihui/knitr#2324) to propose this.
As far as I can tell, progressr::handlers(global = TRUE) is for interactive use.
No, it's not only for interactive use. It also works in batch mode, e.g. Rscript script.R. The problem is that it does not work when called within things such as withCallingHandlers(), tryCatch(), ..., and that's the problem in several case, including knitr, rmarkdown, etc.
So, I'll do the next best thing: in every vignette and website article, before loading my package, I briefly explain to users how to activate the package. But I place these in Rmd with the eval = FALSE chunk option, like so:
In trying to demonstrate the functionality of my package to users, I want to make progress bars as invisible as possible. Yet, using the fantastic progressr implementation, I need to show users how to activate global handling of progress bars. But how can I do this in an R Markdown (Rmd) file for a vignette? Even this very minimal example crashes:
In the [progressr] package documentation, we are told "In such cases, the global progress handler has to be enabled prior to processing the document, e.g."
But how is that possible in standard package documentation? As far as I can tell,
progressr::handlers(global = TRUE)
is for interactive use. I do not see how a package developer can easily communicate this information to their package users. I would appreciate any help with this.The text was updated successfully, but these errors were encountered: