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

From: Krystian Radlak <radler12_at_op.pl>
Date: Thu, 21 Jul 2011 01:54:47 -0700 (PDT)


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.

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu 21 Jul 2011 - 08:59:55 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 24 Jul 2011 - 22:10:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive