[R] Display number in currency notation with commas

Pete Brecknock Peter.Brecknock at bp.com
Mon Jan 2 17:15:59 CET 2012


eigenvalet wrote
> 
> How can I display a number as currency including a $ sign and commas?
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Display-number-in-currency-notation-with-commas-tp4253460p4253460.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help@ mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

One way ....

myNum=1111
paste("$",format(myNum, big.mark=","),sep="")

HTH

Pete

--
View this message in context: http://r.789695.n4.nabble.com/Display-number-in-currency-notation-with-commas-tp4253582p4253695.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list