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

Do not show progress bar if knitting #15

Closed
zeehio opened this Issue Dec 6, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@zeehio
Copy link

zeehio commented Dec 6, 2016

When a document is being rendered with knitr, is.null(getOption("knitr.in.progress")) will be FALSE.

Is it possible to use that option so by default the progress bar is not shown when knitting a document, even if the knitting is done from an interactive console? I would think that is the usual expected behaviour.

This is how is being done in the dplyr package:

https://github.com/hadley/dplyr/blob/6153e136fa9397e88478fa6270d9d1f02eb5153e/R/progress.R#L96

Even if it is not possible, thanks for your work

@psolymos

This comment has been minimized.

Copy link
Owner

psolymos commented Dec 6, 2016

pbapply does not currently check knitr options, but I guess it could. The interactive mode is checked in zzz.R during .onLoad. Checking knitr option would not impose dependency, so it is a good suggestion.

I actually did not want the progress bar shown when knitting, because it prints a line for every update. But if you want it back, it is certainly doable in one way or another. You can turn on the progress bar with pboptions(type="timer") for example.

@psolymos psolymos added the enhancement label Dec 6, 2016

@psolymos

This comment has been minimized.

Copy link
Owner

psolymos commented Dec 6, 2016

I re-read your comment. OK, makes sense. You do not want the pb shown even when it is interactively running through knitr. It should be an easy fix, will need some testing.

Show pb when interactive and not rendering: interactive() && is.null(getOption("knitr.in.progress"))

psolymos added a commit that referenced this issue Dec 6, 2016

psolymos added a commit that referenced this issue Dec 6, 2016

psolymos added a commit that referenced this issue Dec 6, 2016

@psolymos

This comment has been minimized.

Copy link
Owner

psolymos commented Dec 6, 2016

Now it works as expected, see example at the end of the tests.R file here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment