[Rd] Unable to read.table with > 256? columns (PR#649)

Prof Brian D Ripley ripley@stats.ox.ac.uk
Thu, 31 Aug 2000 07:23:53 +0100 (BST)


On Thu, 31 Aug 2000 r@marksmucker.com wrote:

> Full_Name: Mark Smucker
> Version: 1.0.1
> OS: Windows NT 4 sp 6
> Submission from: (NULL) (216.122.46.200)
> 
> 
> 
> I'm trying to read in a large matrix (800 x 800 or bigger)
> and R prints an error telling me that my rows are not
> all the same length.  I've double checked the text file
> using gawk and it tells me that they are all the same.
> 
> When I pair it down to 247 x 247, then it works, but not
> when I have 289 x 289.  I'm guesing that there is some
> hardcoded 256 column limit, but I could be wrong.

Not that I know of.  But as you want to read a matrix, you will
do much better to use scan to read it as than has less overhead
and allows you to use much shorter lines in the file.  It will
just read consecutive numbers.  As in

A <- matrix(scan("file", what=0), 800, 800, byrow=TRUE)

> Otherwise, I'm loving R.  Thank you so much!

Yours is two versions old now, so please update to 1.1.1.

Here is my test (on 1.1.1 on Windows)

> x <- rnorm(300*300)
> write(x, "file", 300)
> A <- matrix(scan("file", what=0), 300, 300, byrow=TRUE)
> B <- as.matrix(read.table("file"))
> range(A-B)
[1] 0 0

So no limit and no problem. I no longer have a copy of 1.0.1 installed, so
if this is still a problem after you upgrade, can you please re-submit the
bug report with an example that actually fails for you.

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._