[R] Numbers with correct significant digits

RMan54 RMan54 at cox.net
Fri Nov 17 23:14:58 CET 2006


This, for example:

v  <- c(9.6996, 99.99)
formatC(v, digits=3, format="g")

shows:

" 9.7" " 100"

This is scientifically incorrect for the first number in the sense that I
like to show all 3 significant digits, including trailing zero's.
Is there a way that the first number would show as " 9.70"?

By the way, can't use format() since it applies the same numbers of digits
after the decimal point for all numbers in the vector.

Thanks,
Rene

-- 
View this message in context: http://www.nabble.com/Numbers-with-correct-significant-digits-tf2657246.html#a7412042
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list