On Tue, Apr 17, 2012 at 11:06:05AM -0700, David Schaefer wrote: > Hello, > > I would like to run some code in parallel with each cluster reading/writing > to a different working directory. I've tried the following code without > success. The error I get is: "Error in setwd(x) : cannot change working > directory" > > library(parallel) > dirs <- list("out1","out2","out3") # these directories are located within > the current working directory > temp <- 1:3 > testF <- function(x) { > setwd(x) > saveRDS(temp,"temp.drs") > } > mclapply(dirs, testF)
Hi. Try to include print(getwd()) to testF() function, so that you see, where the script is running. Another option is not to use setwd() and use saveRDS(temp, paste(x, "temp.drs", sep="/")) instead of saveRDS(temp,"temp.drs"). Hope this helps. Petr Savicky. ______________________________________________ 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.