exponent2prefix {ggspectra}R Documentation

SI unit prefixes

Description

Convert SI unit prefixes into exponents of ten of multipliers and vice-versa.

Usage

exponent2prefix(
  exponent,
  char.set = getOption("photobiology.fancy.chars", default = "utf8")
)

exponent2factor(exponent = 0, if.zero.exponent = "1")

exponent2prefix_name(exponent)

prefix_name2exponent(name)

prefix2exponent(
  prefix,
  char.set = getOption("photobiology.fancy.chars", default = "utf8")
)

has_SI_prefix(exponent)

nearest_SI_exponent(exponent)

Arguments

exponent

numeric The power of 10 of the unit multiplier.

char.set

character How to encode Greek letters and other fancy characters in prefixes: "utf8", "ascii", "LaTeX". The difference between "utf8" and "ascii" is that the first uses UTF8 character "micro" (similar to Greek mu) and the second uses "u".

if.zero.exponent

character string to return when exponent is equal to zero.

name

character Long SI name of multiplier.

prefix

character Unit prefix used for multiplier.

Note

To change the default char.set, set R option "photobiology.fancy.chars". Implementation is based on a table of data and extensible to any alphabet supported by R character objects by expanding the table.

Examples


exponent2prefix(3)
exponent2prefix(0)
exponent2prefix(-6)


exponent2factor(3)
exponent2factor(0)
exponent2factor(0, NULL)
exponent2factor(0, "")
exponent2factor(-6)


[Package ggspectra version 0.3.12 Index]