From ligges at statistik.uni-dortmund.de  Sat Apr  5 17:04:17 2003
From: ligges at statistik.uni-dortmund.de (Uwe Ligges)
Date: Sat Apr  5 16:04:43 2003
Subject: [Rd] write.matrix has limited line length -> truncation (PR#2722)
In-Reply-To: <200304030649.h336n6n9015805@pubhealth.ku.dk>
References: <200304030649.h336n6n9015805@pubhealth.ku.dk>
Message-ID: <3E8EE261.9070108@statistik.uni-dortmund.de>

christen@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


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