[Rd] write.matrix has limited line length -> truncation (PR#2722)

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Apr 5 17:04:17 MEST 2003


christen at chemie.hu-berlin.de wrote:
> Full_Name: Dr. Wolfgang Christen
> Version: 1.62
> OS: Windows 2000
> Submission from: (NULL) (141.20.76.99)
> 
> 
> I have a matrix of 705 x 999 elements and would like to save the data to a file
> using the follwing line:
> write.matrix ( format ( U1r, digits = 15 ), file = "C:\\Documents and
> Settings\\Administrator\\My Documents\\R\\plot-u2-2.txt" )
> 
> Then I had to find out that only 195 (out of 705) columns were saved :-(
> 
> I tried then to reduce the accuracy to 5 digits, which gave me 373 columns,
> already better, but still insufficient. 
> 
> So my suspicion is that an internal line buffer is limited to something less
> than 4k and all subsequent data gets truncated and thus will not be saved.

I've just tried it out with a 1000x1000 matrix with R-1.6.2 on WinNT4.0:

library(MASS)
set.seed(123)
write.matrix(matrix(format(rnorm(1000000), digits = 15),
     ncol = 1000), file = "c:/test.txt")

It works! So could you provide an example (don't send a file, please!)?

Uwe Ligges



More information about the R-devel mailing list