[R] Entering numbers with decimals

Mike Leahy mgleahy at alumni.uwaterloo.ca
Sat Apr 8 21:51:03 CEST 2006

Hello list,

I'm just getting started with R, and I'm trying to determine how R
treats large numbers that have decimals.  Take the following two examples:

> x <- c(999999999999999.9)
> sprintf("%.5f",x)
[1] "999999999999999.87000"

> y <- c(9999999999999999.9)
> sprintf("%.5f",y)
[1] "10000000000000000.00000"

I realize that I have no idea what I'm doing as far as using R is
concerned, but maybe someone can tell me what would be the best way to
input/output numbers such that they don't get rounded off in unexpected
ways.  I've been searching online and looking through various R manuals,
but I haven't found anything that really clarifies this so far...

Thanks in advance for any advice,


More information about the R-help mailing list