(PR#2722) [Rd] Christen claimed `write.matrix has limited line length -> truncation', without a shred of evidence.

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Apr 8 20:26:16 MEST 2003


Is this the write.matrix from package MASS not being given due credit?

If so, that uses cat, and if that has a line-length limit it is in the OS
and not in R.  (Some deficient OSes will have line-length limits under
some circumstances, but I believe never less than 8095.)

Under Linux:

> A <- matrix(rnorm(705*10), 10)
> library(MASS)
> write.matrix(format(A, digits=15), file="foo")
> q()
Save workspace image? [y/n/c]: n
gannet% wc foo
     10    7050  155100 foo

and that means there are 7050 entries in 10 lines of around 15k chars
each.  No evidence of truncation there!

Under Windows XP I get identical results.

BTW, please read the section on BUGS in the FAQ, and next time do send a 
reproducible example (and a non-zero amount of evidence for the claimed 
bug).

BDR

On Thu, 3 Apr 2003 christen at chemie.hu-berlin.de wrote:

> Full_Name: Dr. Wolfgang Christen
> Version: 1.62

There is no such version: did you misread 1.6.2? 

> 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 :-(

Where is your evidence?  Perhaps the tools *you* used truncated the file?

> 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.

Don't send suspicions: send real experimental data.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list