From radler12 at op.pl  Thu Jul 21 10:54:47 2011
From: radler12 at op.pl (Krystian Radlak)
Date: Thu, 21 Jul 2011 01:54:47 -0700 (PDT)
Subject: [Rd] Saving data into a text or CSV file using foreach/doSNOW
Message-ID: <1311238487719-3683155.post@n4.nabble.com>

Dear list, 

I am using the foreach/doSNOW packages. I want to compute some data parallel
and save results in every iteration  into a text or CSV file, but then I see
in file there are some errors (some data is not saved to file and there are
empty lines). I have tested every function to append data into file and I
also tested append data to one file or more (For two processor I have saved
data into two files.), but I could solve this problem. How can I solve this
problem?

foreach(i = 1:n,.packages = "xyz") %dopar%  my_function(i)

my_function(i)
{
    #some code

zz <-
file(paste(cmd_args[7],toString(i%%as.numeric(cmd_args[3])),".txt",sep=""),
"at")
write(rr,file=zz)
close(zz)
} 


Best,

Krystian

--
View this message in context: http://r.789695.n4.nabble.com/Saving-data-into-a-text-or-CSV-file-using-foreach-doSNOW-tp3683155p3683155.html
Sent from the R devel mailing list archive at Nabble.com.



[Rd] Saving data into a text or CSV file using foreach/doSNOW
Krystian Radlak