kmgformat: kmgformat - Nice Formatting of Numbers

Description Usage Arguments Value Examples

View source: R/generic.R

Description

This function will convert thousand numbers to K, millions to M, billions to G, trillions to T, quadrillions to P

Usage

1
kmgformat(input, roundParam = 1)

Arguments

input

A vector of values

roundParam

How many decimal digits you want

Value

A character vector of formatted numebr names

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 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=val2col(a))
kmg<-kmgformat(pretty(a))
axis(2,at=pretty(a),labels=kmg)

vulcan documentation built on Nov. 8, 2020, 8:15 p.m.