[R] Limit when reading in file?
David Winsemius
dwinsemius at comcast.net
Tue Aug 16 19:54:17 CEST 2011
On Aug 16, 2011, at 1:33 PM, Sarah Goslee wrote:
> 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.
... but # is another cause of obscure input errors
>
>> 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).
... and you can suppress the handling of comments with
..., comment.char="", ...
>
> 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
>
> --
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list