Dear UserRs,

I have a little problem creating a file connection when working in parallel
(see the reproducable script below).
I am sure this is something obvious,
Can you enlighten me ?

Thanks,

Arnaud



# This part works
#----------------
cat("This is a test file" , file={f <- tempfile()})
con <- file(f, "rt")


# Doing what I think is the same thing gives an error message when executed
in parallel
#--------------------------------------------------------------------------------------

library(parallel)
cl <- makeCluster(2)

## Exporting the object f into the cluster

  clusterExport(cl, "f")
  clusterEvalQ(cl[1], con <- file(f[[1]], "rt"))
   #Error in checkForRemoteErrors(lapply(cl, recvResult)) :
   # one node produced an error: cannot open the connection


## Creating the object f into the cluster

  clusterEvalQ(cl[1],cat("This is a test file" , file={f <- tempfile()}))
  clusterEvalQ(cl[1],con <- file(f, "rt"))
   #Error in checkForRemoteErrors(lapply(cl, recvResult)) :
   # one node produced an error: cannot open the connection

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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