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

emit progressr::progressor() progress bar from knit() #2077

Closed
3 tasks done
maxheld83 opened this issue Dec 2, 2021 · 1 comment · Fixed by #2196
Closed
3 tasks done

emit progressr::progressor() progress bar from knit() #2077

maxheld83 opened this issue Dec 2, 2021 · 1 comment · Fixed by #2196

Comments

@maxheld83
Copy link
Contributor

maxheld83 commented Dec 2, 2021

I'd like to be able to handle the progress information of knitr documents more flexibly.
I'd like to be able to determine handling/presentation of knitr progress as a caller (a design suggested by progressr).

This is closely related to:

@cderv also raises parts of this in #2035 (comment).

I'm logging this as a separate ticket because I'm suggesting emitting progressr::progressor() in particular, potentially in addition to / independent of how knitr should present progress (~ logs?) by default.


Use case(s)

Rendering from Shiny

I'm writing a shiny app to programmatically create rmarkdown reports.
I'd like to pass on information about the progress of the rendering sessions to my users.

The knitr::knit(quiet = FALSE)/rmarkdown::render(quiet = FALSE) is great for developers or R users who render a single Rmarkdown document, but less so for non-technical users via shiny.

(I am aware that I can advance the shiny::Progress$new()progress bar from inside the rmarkdown document as per rstudio/shiny#1660, but this seems a little inelegant, because it's not really a concern of the rmarkdown report.)

Building on top of knitr::knit()

Separately, when building stuff on top of knitr::knit(), such as functions which create many rmarkdown reports, it would also be nice to access the progress of each of the reports.
In this case, too, both quiet = FALSE seems overwhelming.

Proposed solution

Perhaps, the fundamental limitation is that knitr::knit(quiet = FALSE)

  • makes progress an "all or nothing" choice
  • serves both as log and as progress bar

I seems to me that progressrs design to leave the presentation of progress bar (or whatever else you want to do with it) to the caller might make sense here to make knitr::knit() more flexible.

Therefore, I wonder if knitr::knit() could emit a progressr::progressor() object, which callers could then use as they please.
(This could be optional so as not to take on a dependency).



By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('knitr'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/knitr').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant