Home > Net >  Error in mclapply(., function(x) { : 'mc.cores' > 1 is not supported on Windows
Error in mclapply(., function(x) { : 'mc.cores' > 1 is not supported on Windows

Time:08-05

How do I use this line in windows?

mclapply(.,
           function(x) {filter_taxa(x, function(y) sum(y) > 0, TRUE)},
           mc.cores = nrow(params_2)) -> # remove 0-summed ASVs
  Ps_obj_SIP_each_rep_l```

I need to replace mclapply and mc.cores to a proper function in windows. 

CodePudding user response:

mclapply() does the same as lapply, but over multiple cores. So to refactor it to work without parallelization, simply try this;

lapply(., function(x) {filter_taxa(x, function(y) sum(y) > 0, TRUE)})

See more in the mclapply docs:

mclapply is a parallelized version of lapply,

  •  Tags:  
  • r
  • Related