Alessandro Antonucci wrote:
> Reading a csv file (db.csv) as:
> 
> yes,full
> no,full
> no,empty
> 
> I can use the command 'levels' to extract
> the different values appearing for each
> column as follows:
> 
>> d<-read.csv("db.csv")
>> levels(d[,2])
> 
> which returns
> 
>> [1] "empty" "full" 
> 
> while, doing the same with a numerical csv file as:
> 
> 1,6
> 0,6
> 0,7

R (i.e. read.csv) assumes this is numeric rather than categorical data.
Hence specify the class of each variable in read.cvs' argument "colClasses".

Uwe Ligges



> the same instruction returns an empty output instead of 6 7
> 
> Any idea about that?
> 
> Thanks in advance,
> Alessandro
>

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to