[R] How long does skipping in read.table take

Dimitri Liakhovitski dimitri.liakhovitski at gmail.com
Sat Oct 23 15:20:58 CEST 2010


This is very helpful, Gabor.
I've run the code to figure out the end of the line and here is what I
am seeing at the end of each line: \r\n
So, I specified like this:
mydata<-read.csv.sql("myfile.txt", sep="|", eol="\r\n", sql = "select
* from file limit 200, 100")

However, again it's hanging again. Another typo?



On Sat, Oct 23, 2010 at 8:22 AM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> On Sat, Oct 23, 2010 at 7:44 AM, Dimitri Liakhovitski
> <dimitri.liakhovitski at gmail.com> wrote:
>> Gabor,
>> maybe some of my code is wrong (I don't know sql at all). I tried the
>> following with just a few lines as a test:
>> library(sqldf)
>> mydata<-read.csv.sql("myfile.txt",sep="|", sql = "select * from file 200, 100")
>
> "limit" was missing in my post.  It should be:
>
>   mydata<-read.csv.sql("myfile.txt",sep="|", sql = "select * from
> file limit 200, 100")
>
> Usually hangs mean that eol is wrong.  Also try not specifying eol as
> well as eol = "\n", eol = "\r" and eol = "\r\n" and see if any of
> those work (after correcting the missing "limit").
>
> You can also verify what the end of line characters are directly by
> reading in sufficient characters in binary so that at least one line
> is read in. If the first line has fewer than 1000 characters then, in
> R:
>
> L <- readBin("myfile.csv", "raw", 1000)
> rawToChar(L)
>
> --
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com
>



-- 
Dimitri Liakhovitski
Ninah Consulting
www.ninah.com



More information about the R-help mailing list