Hi,

I want to impute a data set multiple times, but the data set is large so it takes a long time.  As a result, I'm trying to run the multiple imputation with parallel processors in Windows, but am having trouble.  Here is a quick example:

######
library(foreach)
library(doSNOW)
registerDoSNOW(makeCluster(4, type = "SOCK"))
getDoParWorkers()
getDoParName()
getDoParVersion()

data(africa)

iterations <- 4
foreach(i = 1:iterations) %dopar% {
  amelia(x = africa, m=1, cs = "country", ts = "year", logs = "gdp_pc")
}
######

When I run the foreach loop, I receive the following warning

Error in { : task 1 failed - "could not find function "amelia""



This is a bizarre error because I have loaded the amelia package and can impute data sets fine outside of the foreach loop.  Moreover, if I change %dopar% to %do% to run the imputations in sequence rather than in parallel, the imputations run fine with no errors.  How do I get Amelia to impute one data set (m=1) on each of 4 different processors.  Finally, how do I combine the data sets after imputing them in parallel -- I assume using the ameliabind() function?  How can I do this?



Thanks for all your help.  By the way, I'm new to Amelia, so any help would be greatly appreciated!