[R] 1.095e+09 for integers

Bernardo Rangel Tura tura at centroin.com.br
Mon Feb 23 10:51:28 CET 2009


On Sun, 2009-02-22 at 23:42 -0500, Alexy Khrabrov wrote:
> I've had a very long file written out by R with write.table, with  
> fields of time values, converted from POSIXlt as.numeric.  Among 2.5  
> million values, very few had 6 trailing zeroes, and those were output  
> in scientific notation as in the subject.  Is this the default  
> behavior for long integers, and how can it be turned off (with all  
> digits for any integer field in write.table)?  This is important to  
> interoperate with other languages through such text dumps, as some do  
> not expect scientific notation for integers, only for floats.
> 
> Cheers,
> Alexy

Alexy 

If I understood your problem you have something like this


as.numeric(12345678912345678)
[1] 1.234568e+16

In this case your solution is using format, like this

format(as.numeric(12345678912345678),scientific=FALSE)
[1] "12345678912345678


-- 
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil




More information about the R-help mailing list