[R] parallel processing with multiple directories

David Schaefer David.Schaefer at asu.edu
Tue Apr 17 20:06:05 CEST 2012


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)

Any help would be appreciated!

--David

*********************************************
David R. Schaefer, Ph.D.
Assistant Professor
School of Social and Family Dynamics
Arizona State University
www.public.asu.edu/~schaef/



More information about the R-help mailing list