Re: [R] Row limit for read.table

From: Frank McCown <fmccown_at_cs.odu.edu>
Date: Wed 17 Jan 2007 - 17:22:40 GMT

> In your case, read.table behaves as documented.
> The ' - character is one of the standard quoting characters. Some (but
> very few) of the entrys contain single ' chars, so sometimes more than
> ten thousand lines are just treated as a single entry. Try using
> quote="" to disable quoting, as documented on the help page:
>
> f<-read.table("http://www.cs.odu.edu/~fmccown/R/Tchange_rates_crawled.dat",
> header=TRUE, nrows=123000, comment.char="", sep="\t",quote="")
>
> length(f$change_rate)
> [1] 122271

So either adding quote="" works or removing sep="\t" (and not using quote) works. It seems an odd side-effect that specifying the separator changes the default behavior of quoting (because of the ' character). I don't see that association made in the help file.

> There is (colClasses, works as documented). Try
>
> f<-read.table("http://www.cs.odu.edu/~fmccown/R/Tchange_rates_crawled.dat",
> + header=TRUE, nrows=123000, comment.char="",
> sep="\t",quote="",colClasses=c("character","NULL","NULL","NULL","NULL"))
> > dim(f)
> [1] 122271 1

> Did you read the help page?

Of course I did. For me the definition of colClasses wasn't clear... "A vector of classes to be assumed for the columns" didn't seem to be the same thing as "the columns you would like to be read." I may have made the association if the help page had contained a simple example of using colClasses.

Thanks for the help,
Frank

-- 
Frank McCown
Old Dominion University
http://www.cs.odu.edu/~fmccown/

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu Jan 18 04:28:03 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 17 Jan 2007 - 17:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.