[R] 2 significant digits
carol white
wht_crl at yahoo.com
Tue Nov 10 17:22:07 CET 2009
Hi,
How to represent a rounded number ending with 0 with 2-significant digits? If I have for ex, 0.8031 and I use signif or round with digits = 2, I'll get 0.8. If I use format, I get character type (even if I pass number as parameter) and if I convert with as.numeric, I'll lose one significant digit (0):
> format(13.7, nsmall = 2)
[1] "13.70"
> as.numeric( format(13.7, nsmall = 2))
[1] 13.7
Regards,
Carol
More information about the R-help
mailing list