Re: [R] writing 100 files

From: Marc Schwartz (via MN) <mschwartz_at_mn.rr.com>
Date: Tue 23 May 2006 - 01:38:20 EST

On Mon, 2006-05-22 at 16:24 +0100, Federico Calboli wrote:
> Hi All,
>
> I need to write as text files 1000 ish variation of the same data frame,
> once I permute a row.
>
> I would like to use the function write.table() to write the files, and
> use a loop to do it:
>
> for (i in 1:1000){
>
> bb8[2,] = sample(bb8[2,])
> write.table(bb8, quote = F, sep = '\t', row.names = F, col.names = F,
> file = 'whatever?????.txt')
> }
> so all the files are called whatever1: whatever1000
>
> Any idea?
>
> Cheers,
>
> Federico

The same process used in R FAQ 7.34:

  How can I save the result of each iteration in a loop into a separate   file?

can be used here. Instead of using save(), use write.table(), adjusting the arguments accordingly.

HTH, Marc Schwartz



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue May 23 02:00:25 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 23 May 2006 - 02:10:19 EST.

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