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

Else condition needed for future.apply check #126

Closed
kendavidn opened this issue Feb 20, 2023 · 1 comment
Closed

Else condition needed for future.apply check #126

kendavidn opened this issue Feb 20, 2023 · 1 comment

Comments

@kendavidn
Copy link

Thanks for the fantastic package!

I may be wrong but it seems that there is a problem with this code, which is used in the lmerModList() family of functions:

if(parallel) {
    if (requireNamespace("future.apply", quietly=TRUE)) {
      ml <- future.apply::future_lapply(data, function(d) blmer(formula, data = d, ...))
    }
    warning("Parallel set but future.apply not available. Running sequentially.")
    ml <- lapply(data, function(d) blmer(formula, data = d, ...))
  }

If the future function is available, the line ml <- future.apply... will be run BUT the warning() line and the line after that will ALSO be run.

So whether or not future.apply is available, the warning will still be printed, and the regular lapply line will still run.

An else would solve this I think.

@jknowles
Copy link
Owner

Thanks that is right!

jknowles added a commit that referenced this issue Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants