[R] RMySQL typing Problem (bigint unsigned)

Duncan Murdoch murdoch at stats.uwo.ca
Mon Jul 4 16:53:58 CEST 2005


On 7/4/2005 9:50 AM, Dubravko Dolic wrote:
> Dear Group,
> 
>  
> 
> if anyone has experience with the RMySQL Package maybe this behaviour is know:
> 
>  
> 
> Reading data from a table into R the fields with datatype bigint(20) unsigned are transformed in some way: e.g. the query "select * from orders where userid = 14929859848712890325" selects the correct case but in R the userid is changed to 14929859848712890368. What happened here? This transformation is true for all fields of that type...

R doesn't have a bigint type, so I imagine these are being changed to 
doubles.  In double precision those are the same number.

I don't know the best way to handle this, but one way would be to do SQL 
calculations to extract the lower 10 digits separately from the upper 10 
digits.  R doubles can represent 10 digit integers exactly.

Duncan Murdoch




More information about the R-help mailing list