[R] writing 100 files

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon May 22 17:38:45 CEST 2006


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
> 

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

Please read the FAQs prior to posting!

Uwe Ligges



More information about the R-help mailing list