Non exportable references in future_map

412 views Asked by At

I am experimenting for the first time with the furrr package, especially with the future_map group of functions.

I'm having trouble understanding how to avoid running into the problem of non-exportable references even with extremely basic functions. Here is a toy example:

my_sum = function(x, a){
    return(x+a)
}
options(future.globals.onReference = "error")

library(furrr)
plan(multiprocess)
test = future_map(.x= 1:10, .f = my_sum, a = 1)

While the function does run if I don't set the error option, there is clearly some issue in the background, as the error reads Detected a non-exportable reference (‘externalptr’) in one of the globals (<unknown>) used in the future expression. I really don't understand how to get around this, any help?

Additional info: running Windows. R is version 4.0.2, furrr is version 0.1.0, future is version 1.19.1

0

There are 0 answers