future doesn't see ... in function

Hi,

I would like to create a personal function for parallel tasks. I would like to use future (MAC OS) to make tasks faster, but it doesn't get the command from ... in a function. I enclose a sample.

Thank you for your answer in advance,
M

library(tidyverse)

ftest <- function(x, ...) {
  library(furrr)
  plan(multisession, workers = 2)

  future_map(x, .f = ~ mutate(.x, ...))

}

iris %>% 
  group_by(Species) %>% 
  group_map(~ .) %>% # split to 3 frames = list
  ftest(s = Sepal.Length + Sepal.Width)

gtest <- function(x, ...) {
  library(furrr)
  plan(multisession, workers = 2)
  
  x %>% 
    nest() %>% 
    mutate(future_map(data, ~ mutate(., ...)))
  
}

iris %>% 
  group_by(Species) %>% 
  gtest(s = Sepal.Length + Sepal.Width)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.