Learn R Programming

datamart (version 0.4.2)

siunit: Generate numeric vector with SI prefixes

Description

Given a basename for the unit, e.g. "m", the function returns a named vector of most or all (extended=TRUE) prefixes defined by SI, i.e. "km", "Mm", "Gm", ... and "mm", "nm", ...

Usage

siunit(uname, value = 1, extended = FALSE)

Arguments

uname
the name of the unit to define, e.g. "g"
value
scaling factor, see details.
extended
logical (default=FALSE), add not so common prefixes?

Value

  • numeric

Details

By default, the prefixes "h", "d", "da" and "c" are not generated. Use extended=TRUE to include these. Use value to define a conversion factor between the unit without prefix and the base unit of the unitset you are defining. value is how many units of uname form one unit of the base unit. Default is 1. The function is internal.

References

http://en.wikipedia.org/wiki/International_System_of_Units