format_metric: format a numeric vector using metric system

Description Usage Arguments Value Examples

View source: R/format_metric.R

Description

format a numeric vector using metric system

Usage

1
2
format_metric(x, prefixes = c("", "k", "M", "G"), digits = 3,
  smart_signif = FALSE, symbol = TRUE, base_unit = "", ...)

Arguments

x

a numeric vector

prefixes

a vector or prefixes (”,'k', 'M', ...), lower case symbols (”,'kilo', 'mega' ...) or powers of tens (0, 3, 6 ...).

digits

integer used by signif or smart_signif

smart_signif

logical, if TRUE smart_signif will be used instead of signif

symbol

logical, if TRUE, full symbol will be used, else prefix will be used

base_unit

character, e.g. 'g'

...

additional arguments passed to formatC

Value

formated character

Examples

1
2
3
format_metric(c(-2500,0.15,3,5e6),c(0,3))
format_metric(c(-2500,0.15,3,5e6),"kilo")
format_metric(c(-2500,0.15,3,5e6),base_unit="€")

moodymudskipper/cutr documentation built on Aug. 23, 2019, 7:15 p.m.