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

Suggestion on progressr #83

Closed
HenrikBengtsson opened this issue Aug 10, 2023 · 4 comments · Fixed by #82
Closed

Suggestion on progressr #83

HenrikBengtsson opened this issue Aug 10, 2023 · 4 comments · Fixed by #82
Labels
before release 📌 TODO before release maintenance 🔨 Code enhancements, tests and maintenance

Comments

@HenrikBengtsson
Copy link

Hello,

while troubleshooting a false-positive CRAN NOTE, I noticed that you use:

if (requireNamespace("progressr", quietly = TRUE)) prog()

in several places. You can avoid the quite expensive(*) calls to requireNamespace("progressr", quietly = TRUE) if you do:

if (requireNamespace("progressr", quietly = TRUE)) {
  prog <- progressr::progressor(along = 1:((length(variables) + 2) * B))
} else {
  prog <- function() NULL
}

Then you can replace:

if (requireNamespace("progressr", quietly = TRUE)) prog()

with

prog()

(*) requireNamespace() hits the file system each time if progressr is not installed.

@mikolajsp
Copy link
Collaborator

Hi,

thanks for the suggestion, this is a very easy fix and we're just working on a new release, I'll try to do it today.

@mikolajsp mikolajsp added before release 📌 TODO before release maintenance 🔨 Code enhancements, tests and maintenance labels Aug 11, 2023
@mikolajsp
Copy link
Collaborator

Hopefully this is resolved in 96b3f3f.

@mikolajsp mikolajsp mentioned this issue Aug 11, 2023
3 tasks
@mikolajsp mikolajsp linked a pull request Aug 11, 2023 that will close this issue
3 tasks
@HenrikBengtsson
Copy link
Author

LGTM. FYI, progressor() has steps argument, so you don't have to create an auxillary along argument. That is, you can use

prog <- progressr::progressor(steps = (length(variables) + 2) * B)

instead.

@mikolajsp
Copy link
Collaborator

Thanks! I'll change that as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
before release 📌 TODO before release maintenance 🔨 Code enhancements, tests and maintenance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants