scientific_format {scales}R Documentation

Scientific formatter.

Description

Scientific formatter.

Usage

scientific_format(digits = 3, scale = 1, prefix = "", suffix = "",
  decimal.mark = ".", trim = TRUE, ...)

scientific(x, digits = 3, scale = 1, prefix = "", suffix = "",
  decimal.mark = ".", trim = TRUE, ...)

Arguments

digits

Number of significant digits to show.

scale

A scaling factor: x will be multiply by scale before formating (useful if the underlying data is on another scale, e.g. for computing percentages or thousands).

prefix, suffix

Symbols to display before and after value.

decimal.mark

The character to be used to indicate the numeric decimal point.

trim

Logical, if FALSE, values are right-justified to a common width (see base::format()).

...

Other arguments passed on to base::format().

x

A numeric vector to format.

Value

A function with single parameter x, a numeric vector, that returns a character vector.

Examples

scientific_format()(1:10)
scientific_format()(runif(10))
scientific_format(digits = 2)(runif(10))
scientific(1:10)
scientific(runif(10))
scientific(runif(10), digits = 2)
scientific(12345, suffix = " cells/mL")

[Package scales version 1.0.0 Index]