[R] Printing 2 digits after decimal point [SOLVED]

Sharpie chuck at sharpsteen.net
Mon Feb 15 12:09:55 CET 2010



T.Wunder wrote:
> 
> Hi,
> 
> I'm sorry, I've found the right answer:
>> x <- 0
>> formatC(x,digits=2, format="f")
> [1] "0.00"
> 
> The above worked perfectly!
> Thanks & Best wishes ;)
> Tom
> 

That old warhorse, sprintf(), can also be a trusty steed in situations like
this.

-Charlie
-- 
View this message in context: http://n4.nabble.com/Printing-2-digits-after-decimal-point-tp1555981p1555987.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list