[R] read.table & readLines behaviour?
J.delasHeras at ed.ac.uk
J.delasHeras at ed.ac.uk
Wed Sep 24 12:29:23 CEST 2008
The result was 11, 24001 times, as I expected originally. hmmm...
Quoting Gabor Grothendieck <ggrothendieck at gmail.com>:
> Try looking at the result of count.fields to diagnose it.
> On Tue, Sep 23, 2008 at 5:19 AM, <J.delasHeras at ed.ac.uk> wrote:
>> I have been using 'read.table' regularly to read tab-delimited text files
>> with data. No problem, until now.
>> Now I have a file that appeared to have read fine, and the data inside looks
>> correct (structure etc), except I only had 15000+ rows out of the expected
>> 24000. Using 'readLines' instead, and breaking up the data by tabs, gives me
>> the expected result.
>> I do not understand why this is happening and I can't find anything obvious
>> in the data to explain the bahaviour...
>> Does anybody have an explanation? something to watch out for?
>> If I run this I get the incomplete set:
>>  15733 11
>> but I get the right data if I use:
>>> for (i in 1:24000) tmp[i,]<-unlist(strsplit(probesets[i+1],split="\t"))
>>  24000 11
>> Here's my sessionInfo output:
>> R version 2.7.0 (2008-04-22)
>> LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
>> Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
>> attached base packages:
>>  stats graphics grDevices datasets tcltk utils methods
>>  base
>> other attached packages:
>>  limma_2.14.0 svSocket_0.9-5 svIO_0.9-5 R2HTML_1.59 svMisc_0.9-5
>>  svIDE_0.9-5
>> loaded via a namespace (and not attached):
>>  tools_2.7.0
>> Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk
>> The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374
>> Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360
>> Swann Building, Mayfield Road
>> University of Edinburgh
>> Edinburgh EH9 3JR
>> The University of Edinburgh is a charitable body, registered in
>> Scotland, with registration number SC005336.
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk
The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374
Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360
Swann Building, Mayfield Road
University of Edinburgh
Edinburgh EH9 3JR
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the R-help