format_SI: Format according to SI conventions

format_SIR Documentation

Format according to SI conventions

Description

Format according to SI conventions

Usage

format_SI(
  x,
  digits = NULL,
  fixed = FALSE,
  engineering = FALSE,
  ...,
  verbose = getOption("verbose")
)

Arguments

x

(numeric)

digits

(numeric) passed to format_digits() under certain conditions (see Details)

fixed

(logical) see Details

engineering

(logical) see Details

...

reserved for future use / backwards-compatibility

verbose

(logical)

Details

If fixed is TRUE, the suffix will not be allowed to vary. The suffix corresponding to the largest value in abs(x) will be used.

If engineering is TRUE, the magnitudes will shift upwards by 3 for numbers less than 0.

See Also

  • format_qty()

  • format_digits()

Examples

format_SI(1)
format_SI(9:11)
format_SI(c(33, 333, 3333, 33333333))
format_SI(seq(0, 1.2, len = 7) * 1000)
format_SI(seq(0, 1.2, length.out = 5) * 1e3, fixed = TRUE)
format_SI(seq(0, 0.9, length.out = 4) * 1e3, fixed = TRUE)

format_SI(seq(0, 0.9, length.out = 4) * 1e3, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 0.9, length.out = 4) * 1e4, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 0.9, length.out = 4) * 1e5, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 0.9, length.out = 4) * 1e6, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 0.9, length.out = 4) * 1e7, fixed = TRUE, engineering = TRUE)

format_SI(seq(0, 1.25, length.out = 6) * 1e2, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 1.25, length.out = 6) * 1e3, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 1.25, length.out = 6) * 1e4, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 1.25, length.out = 6) * 1e5, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 1.25, length.out = 6) * 1e6, fixed = TRUE, engineering = TRUE)

format_SI(seq(0, 0.75, length.out = 4) * 1e0, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 0.75, length.out = 4) * 1e1, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 0.75, length.out = 4) * 1e2, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 0.75, length.out = 4) * 1e3, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 0.75, length.out = 4) * 1e4, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 0.75, length.out = 4) * 1e5, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 0.75, length.out = 4) * 1e6, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 0.75, length.out = 4) * 1e7, fixed = TRUE, engineering = TRUE)
format_SI(seq(0, 0.75, length.out = 4) * 1e8, fixed = TRUE, engineering = TRUE)

format_SI(seq(0, 1.00, length.out = 5) * 1e8)


BAAQMD/strtools documentation built on Nov. 23, 2023, 5:52 a.m.