A unitbundle is an object containing information about a single set of units - for example, kg m^2 s^-2 or mi hr^-1. This information is stored in a way that permits efficient units conversion and arithmetic.
There are several ways to create a unitbundle, all of which use the standard
unitbundle(...). Exactly one or zero arguments from
unitbdl] may be
specified; the choice or argument determines which construction method is
used. If the
units argument is specified, with or without the 'units'
label, then the class of that argument determines whether it is interpreted
unitdf argument (if it's a data.frame), a
(if it's a character), or a
unitbdl argument (if it's a unitbundle).
A data.frame (unitdf method), character (parse string method), or unitbundle (replica method). Although the code is cleaner, it is slightly less efficient to use this units argument than to explicitly specify unitdf, unitstr, or unitbdl.
A single-character string, relevant only when
Other arguments passed to initialize
A data.frame with columns Unit=character, Power=numeric, specifying each unit-power pair in a separate row.
A single character string containing one or more units to be
parsed and bundled, e.g.
A unitbundle. If this is supplied, the new unitbundle is simply a replica of unitbdl.
The basic content of a unitbundle is a collection of units each raised to a
power (see Definitions below). For example,
"kg ha^-1" has two units,
"ha", raised to the powers
respectively. In creating a unitbundle from a character string, the caret
^) is used to indicate the separation between the unit and its
power, and a space usually indicates the separation between two unit-power
Character strings are a potentially ambiguous way to describe units
information; in particular, a unit might itself contain a space or
To specify the contents of a unitbundle without ambiguity, a
may be used to indicate where the text part of a unit begins and ends. For
"g soil^-1" will be incorrectly parsed into
"soil^-1", but this can be avoided by wrapping the two-word unit in
the delimiter: when
"|g soil|^-1" will be
parsed such that
"g soil" is a single unit.
A single property or thing: kg, tree house, kgC_organic
The power to which a unit is raised; assumed to be 1 if
unspecified. 1, 0.53, and 1/2 are powers in unit-power
pairs such as
A combination of units and powers used to describe data:
"kgC ha^-1 yr^-1"
c("kgC ha^-1 yr^-1", "PgN", "ft^3
1 2 3 4 5 6
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.