Dear All, I have a question of how to export S4 class specification to clusters/workers in parallel computing. The package I used is snowfall. The problem is reproducible as follows. Any hint is greatly appreciated.
Edwin Sun === begin =========== library(snowfall) sfInit(parallel = TRUE, cpus = 2) setClass("catt", representation(aa = "numeric")) setClass("dogg", representation(bb = 'character', cc = "catt")) f1 <- function(y1) { new('catt', aa = y1 + 1) } f3 <- function(y2, y3) { new('dogg', bb=c(y2, 'GA'), cc = f1(y3)) } dat <- 1:5 f1(dat) f3('NY', dat) sapply(c("state1", 'state2', 'state3'), f3, dat) sfExportAll() sfClusterEval(ls()) sfSapply(c("s1", 's2', 's3'), f3, dat) sfStop() # sfSapply generates the following error # Error in checkForRemoteErrors(val) : # 2 nodes produced errors; first error: "dogg" is not a defined class === end ============= -- View this message in context: http://r.789695.n4.nabble.com/undefined-S4-class-in-parallel-computing-at-snowfall-tp4634757.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.