[R] writing text and output to file with flexibility

2008-08-30 Thread Gonçalo Ferraz
Hi, I want a function to write some of its output into a text file with the following format: 'some text' output matrix A 'some more text' output matrix B 'some other text still' output matrix C ... The dimensions of matrices A, B, ... are different and the total number of matrices that I

Re: [R] writing text and output to file with flexibility

2008-08-30 Thread Katharine Mullen
you can combine write and write.table, using append=TRUE. e.g., write1 - function(txt, mat, filename) { for(i in 1:length(txt)) { write(txt[i], file=filename, append=i!=1) write.table(mat[[i]], file=filename, append=TRUE,sep =\t) } } t - c(text1, text2, text3) m -