[R] read.table: mysterious line omissions

David Winsemius dwinsemius at comcast.net
Sun Dec 20 06:07:32 CET 2009


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.


>
> 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




More information about the R-help mailing list