Skip to content

Avoid passing ... as a global variable to future_lapply() #10

Open
@HenrikBengtsson

Description

@HenrikBengtsson

You're using something like:

f <- function(X, ...) {
  future_lapply(X, FUN = function(x) g(x, ...))
}

where ... is passed to g() as global variables, in

rangeMapper/R/4_maps.R

Lines 249 to 257 in 575046b

o = future_lapply( unique(cr$cell_id),
function(i){
x = cr[cell_id == i]
E = try(fun(x, ...), silent = TRUE)
E = data.table(E)
E[, cell_id := i]
E
}, future.seed = TRUE )

It's better to pass ... as arguments as in:

f <- function(X, ...) {
  future_lapply(X, FUN = function(x, ...) g(x, ...), ...)
}

I've created PR #9, which fixes this.

Your current approach will give an error in the next release of the future package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions