[R] read.table: mysterious line omissions

David Winsemius dwinsemius at comcast.net
Sun Dec 20 06:19:43 CET 2009


On Dec 20, 2009, at 12:07 AM, David Winsemius wrote:

>
> On Dec 19, 2009, at 11:42 PM, Jonathan wrote:
>
>> Hello again,
>>    I am simply trying to import a rectangular table of strings.  The
>> table's dimensions are 1990 x 2, yet my read.table() command can  
>> only find
>> 362 of the rows (and they're not the first 362).  I would've taken  
>> the time
>> to figure out how to use scan, readLines, or some other tool that  
>> can read
>> in character strings, and then parse and input to a table, but that  
>> seems
>> like overkill, and probably it would be good to understand what's  
>> wrong with
>> my text file.
>>
>> The file is here.
>> https://regtransfers-sth-se.diino.com/download/jonsleepy/_mydropbox_/finalInput.xls
>>
>> The code is here:
>> temp <- as.matrix(read.table('finalInput.xls', header=FALSE, sep =  
>> "\t"))
>> dim(temp) #expect 1990 x 2; but find 362 x 2
>>
>> Sorry to require a download (this probably won't make people  
>> happy), but
>> since my problem is file-specific, the file is needed for  
>> troubleshooting.
>
> There is something wrong with line 362. If you delete it and reload  
> the task completes.

It does complete but not because of something in line 362. What also  
got changes in the process was the file name. Try changing the  
extension to .csv and see if that solves the problem. It does on my  
Mac running R 2.10.1  (... and I don't have an explanation.)
>
>
>>
>> I generated it with some grep, gawk commands using Cygwin in a  
>> Windows
>> environment (though subsequently converted it to Windows format - R  
>> loads it
>> exactly the same way, regardless of whether it's in linux or  
>> windows format)
>>
>> Regards,
>
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
> ______________________________________________
> R-help at r-project.org 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list