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.680" "0.499" "0.642" "0.660" "0.096" "0.766" "0.770" "0.991" "0.971"
#> [10] "0.389"
SI_tg_format(exponent = 2)(runif(10))
#>  [1] "0.004610h" "0.003150h" "0.001750h" "0.005320h" "0.004940h" "0.007790h"
#>  [7] "0.002040h" "0.007130h" "0.000652h" "0.003540h"
SI_tagged(1:10)
#>  [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10"
SI_tagged(runif(10))
#>  [1] "0.825" "0.274" "0.570" "0.336" "0.596" "0.192" "0.948" "0.542" "0.545"
#> [10] "0.279"
SI_tagged(runif(10), digits = 2)
#>  [1] "0.450" "0.370" "0.028" "0.470" "0.390" "0.020" "0.380" "0.560" "0.860"
#> [10] "0.380"