kmgformat | R Documentation |
This function will convert thousand numbers to K, millions to M, billions to G, trillions to T, quadrillions to P
kmgformat(input, roundParam = 1)
input |
A vector of values |
roundParam |
How many decimal digits you want |
A character vector of formatted numebr names
# Thousands
set.seed(1)
a<-runif(1000,0,1e4)
plot(a,yaxt='n')
kmg<-kmgformat(pretty(a))
axis(2,at=pretty(a),labels=kmg)
# Millions to Billions
set.seed(1)
a<-runif(1000,0,1e9)
plot(a,yaxt='n',pch=20,col="black")
kmg<-kmgformat(pretty(a))
axis(2,at=pretty(a),labels=kmg)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.