[R] Limit when reading in file?

Sarah Goslee sarah.goslee at gmail.com
Tue Aug 16 19:33:42 CEST 2011


Hi Noah,

On Tue, Aug 16, 2011 at 1:25 PM, Noah Silverman <noahsilverman at ucla.edu> wrote:
> Hello,
>
> I'm trying to read in a fairly large file into R, and am getting an odd error (65000 rows, 37 columns)
>
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
>  line 25628 did not have 37 elements

The single most common cause of this kind of error is a single or double
quote somewhere in that or the surrounding lines.

> That line DOES have 37 elements.  As A test, I tried deleting it, and a few surrounding lines.  Same error occurs with a different line number.
>
> Is there some hard limit as to how large a file I can import?  If so, any suggested work around?

Check for quotes.

Check your quote option in whatever command you're using to import (you
didn't tell us).

If neither of those work, then offer the list your actual command, and a
small reproducible example (eg the lines right around where the error
appears).

Sarah

-- 
Sarah Goslee
http://www.stringpage.com



More information about the R-help mailing list