[R] write.matrix row names vs sink vs capture.output

Mark Ebbert Mark.Ebbert at hci.utah.edu
Tue Sep 6 08:24:08 CEST 2011

Dear R gurus,

I am trying to write several large matrices (~ 1GB) to separate files. I have learned that write.table is simply too slow for this task and was attempting to use write.matrix, but write.matrix does not have the ability to include row names in the output. Anyone know why that's the case? I've seen a thread stating that write.matrix is the way to go for large prints to files, but it doesn't do what I need it to. Since write.matrix wasn't working I tried both sink and capture.output, but then the output is printed to the file using the same 'width' restrictions as the general "options(width=)" limit.

Any ideas on how to print a large matrix with row names? I could write a perl script to modify the files after the fact, but I shouldn't have to do that.

Thanks for your help!

Mark T. W. Ebbert

More information about the R-help mailing list