Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set thousands separator in R?

Tags:

r

separator

Anybody knows how to set thousands separator in R?
I would like to get in output sth like that:

123 425 231

or

123.425.231

instead of:

123425231

Thanks.

like image 946
max04 Avatar asked Jan 29 '26 14:01

max04


1 Answers

You can try this:

x <- 123456789101112 
formatC(x, format="f", big.mark = ",", digits=0)
#[1] "123,456,789,101,112"

Of course you can change the entry of "big.mark" as you like, e.g., replace it with a whitespace.

like image 171
RHertel Avatar answered Jan 31 '26 04:01

RHertel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!