[R] Problem with data type recognition and conversion

Jim Lemon jim at bitwrit.com.au
Wed Nov 1 10:58:26 CET 2006


tom soyer wrote:
> Hi,
> 
> I have a CSV file with two columns; the first column is date, second column
> is numbers. I used read.csv() to load the file into the variable temp.
> Somehow, R could not recognize my numbers as double. Instead, it thinks
> these numbers are integer even though they all have decimal points (isn't
> that strange?). The problem I ran into is that if I tried to convert the
> numbers to double using as.double, R doesn't give me the original value; e.g.
> 9.92 becomes 805 (see below).
> 
>
The data seem to have been read as a factor, probably due to the wrong 
delimiter being supplied or assumed. Make sure that the delimiter in the 
file is the one specified on the read.* function. Another thing that 
might mess up the input is quote characters.

Jim



More information about the R-help mailing list