multiple: multiple

Description Usage Arguments Details Value Author(s) Examples

View source: R/formatters.r

Description

Order of Magnitude Formatter

Usage

1
2
3
multiple(x, multiple = c("K", "M", "B", "T", "H", "k", "m", "b", "t",
  "h"), big.mark = ",", extra, digits = 0, prefix = "",
  scientific = FALSE)

Arguments

x

Vector of numbers to be formatted.

multiple

The multiple to display numbers in. This symbol will be added to the end of the numbers.

big.mark

Character specifying the thousands separator

extra

DEPRECATED, use big.mark and prefix instead: Function for perform any further formatting.

digits

Number of decimal places for rounding.

prefix

Symbol to put in front of the numbers such as a dollar sign.

scientific

Logical (default: FALSE) indicating if the numbers should be returned in scientific notation.

Details

This divides the number by the appropriate amount and adds on the corresponding symbol at the end of the number.

Value

Character vector of formatted numbers.

Author(s)

Jared P. Lander

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
require(scales)
vect <- c(1000, 1500, 23450, 21784, 875003780)
multiple(vect)
multiple(vect, extra=dollar)
multiple(vect, extra=identity)

require(ggplot2)
data(diamonds)
ggplot(diamonds, aes(x=x, y=y, color=price*100)) + geom_point() + 
scale_color_gradient2(labels=multiple)

useful documentation built on Oct. 8, 2018, 5:04 p.m.