[R] How to read malformed csv files with read.table?

Martin Ballaschk tmp082008 at ballaschk.com
Fri Aug 22 19:18:46 CEST 2008


Hi folks,

thank you for your friendly and immediate help!

Am 22.08.2008 um 17:14 schrieb Prof Brian Ripley:
> Or, better, use header=FALSE, skip=1 and the col.names arg of  
> read.table().

My solution is reading the files without the headers (skip = 1) and  
seperately reading the headers with scan (scan("myfile.CSV", what =  
"character", sep = "\t", nlines = 1). After throwing out the first two  
columns it should be possible to assign the scanned colnames to the  
data.frame colnames.

Cheers
Martin



More information about the R-help mailing list