uconv: Convert between numerical units

Description Usage Arguments Details See Also Examples

Description

This function converts between numerical units. It works similar to the iconv function: You provide vector x and a from and a to unit name and the function converts.

This is an internal class. It administers the unitsets used by the uconv method. One instance, usually the only one, is created at startup.

Internal function to create an UnitSetManager object.

Usage

1
2
3
uconv(x, from, to, uset = NULL)

unitsetmanager()

Arguments

x

numerical vector

from

character, unit to convert from.

to

character, unit to convert to

uset

optional, character, unit set to use.

Details

Additionally, you may provide a unitset name. Here, the analogy to iconv ceases. Think of unitset as a dimension of units, or a context for units. Predefined unitsets are "Length", "Mass", "Energy", and "Temperature". It is recommened to provide the unitset name. A list of available unitsets and the units defined by them can be obtained with uconvlist().

This is a proof of concept for the datamart function.

See Also

datamart

Examples

1
2
3
uconv(1, "horse length", "m", "Length")
uconv(1:10, "TWh", "PJ", "Energy")
getSlots("UnitSetManager2")

Example output

[1] 2.4
 [1]  3.6  7.2 10.8 14.4 18.0 21.6 25.2 28.8 32.4 36.0
      res.env 
"environment" 

datamart documentation built on May 2, 2019, 9:40 a.m.