[R] Help with .csv file reading !

David Winsemius dwinsemius at comcast.net
Thu Jan 19 15:34:52 CET 2012


On Jan 19, 2012, at 9:22 AM, aaurouss wrote:

> Hello,
>
> Here's my problem :
>
> I have a csv file which I have to read with read.table() function (or
> read.csv). The file has about 60000 lines whose data are written  
> this way:
> character;character;character;character
>
> 14/10/2010 13:10;0;49;0;49;
>
> 14/10/2010 13:20;0;49;0;49;
>
> 14/10/2010 13:30;0;49;0;49;
>
>
> I tried to use the function this way:    read.csv("file.csv",sep =
> ";",colClasses = "character", fill="TRUE",as.is=TRUE,h=FALSE).

If you are expecting 5 columns as this would suggest then your  
colClasses argument needs to be rep("character", 5)

>
> Here's what I get as an error:
> Error in fill && length(col.names) > cols :
>  type 'x' incorrect in 'x && y'
>
> I can't find any set of options with any of the read functions that  
> work.

You need to read the read.table documentation again, ... and  
again, ...  and again.

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list