Skip to contents

The labels generated represent the same numbers, but with trailing zeros removed/added and compensated by attaching to each label an SI multiplier "prefix".

Usage

SI_tg_format(exponent = 0, digits = 3, ...)

SI_tagged(x, exponent = 0, digits = 3, ...)

Arguments

exponent

numeric Power of 10 to use as multiplier

digits

number of significant digits to show

...

other arguments passed on to format

x

a numeric vector to format

Value

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

Note

If the exponent passed has no SI prefix defined, the exponent will be adjusted to match one.

Examples


SI_tg_format()(1:10)
#>  [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10"
SI_tg_format()(runif(10))
#>  [1] "0.403" "0.770" "0.119" "0.195" "0.165" "0.663" "0.857" "0.927" "0.552"
#> [10] "0.577"
SI_tg_format(exponent = 2)(runif(10))
#>  [1] "0.006870h" "0.002450h" "0.000446h" "0.009100h" "0.000707h" "0.009970h"
#>  [7] "0.006120h" "0.001730h" "0.009090h" "0.000375h"
SI_tagged(1:10)
#>  [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10"
SI_tagged(runif(10))
#>  [1] "0.594" "0.237" "0.906" "0.819" "0.700" "0.220" "0.728" "0.217" "0.456"
#> [10] "0.333"
SI_tagged(runif(10), digits = 2)
#>  [1] "0.57" "0.25" "0.46" "0.92" "0.97" "0.82" "0.90" "0.58" "0.77" "1.00"