On 22/08/11 12:26, Martin Morgan wrote:
On 08/21/2011 11:52 PM, Allan Engelhardt wrote:
[...]
Obligatory reproducible example: On the Unix machine do

library("multicore")
a <- list(data = 1:10, fun = mclapply)
save(a, file = "a.RData")

and then try to load the "a.RData" file on Windows. The question is if I
can recover the data (1:10) on that platform.

Is this a more realistic reproducible example (from ?rfe, modified to use computeFunction=mclapply)?

  data(BloodBrain)

  x <- scale(bbbDescr[,-nearZeroVar(bbbDescr)])
  x <- x[, -findCorrelation(cor(x), .8)]
  x <- as.data.frame(x)

  set.seed(1)
  lmProfile <- rfe(x, logBBB,
                   sizes = c(2:25, 30, 35, 40, 45, 50, 55, 60, 65),
                   rfeControl = rfeControl(functions = lmFuncs,
                     number = 5,
                     computeFunction=mclapply))

Maybe provide a computeFunction that only indirectly references mclapply

  computeFunction=function(...) {
      if (require(multicore)) mclapply(...)
      else lapply(...)
  }

[...]

Yes, that workaround works for my usage.  Thanks!

Allan

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to