[R] R 1.2.1 - read.table - factors problem or is it a data.frame problem

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Feb 1 15:15:31 CET 2001


"Heberto Ghezzo" <Heberto at meakins.lan.mcgill.ca> writes:

> I have some problems with read.table and floats turning up as 
> factors. In my case it was not a blank in the file but an unary minus!!
> so 3.24,-57.23,... the 3.24 is numeric but -57.23 is a factor.
> Yes I turned it into a numeric with as.numeric(as.character(.. but I 
> think it will be better to modify somehow the read.table/read.csv 
> code.
> Thanks anyway.

That certainly sounds like a bug, but I can't reproduce it:

$ cat > xx  
-1,2,3
1,-2,3
$ R
...
> summary(read.csv('xx',head=F))
       V1             V2           V3   
 Min.   :-1.0   Min.   :-2   Min.   :3  
 1st Qu.:-0.5   1st Qu.:-1   1st Qu.:3  
 Median : 0.0   Median : 0   Median :3  
 Mean   : 0.0   Mean   : 0   Mean   :3  
 3rd Qu.: 0.5   3rd Qu.: 1   3rd Qu.:3  
 Max.   : 1.0   Max.   : 2   Max.   :3  

Could you give us some further details on the setup that is causing
that effect?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list