This function takes the numeric argument x,
quantified in units u1 and converts it to be of units u2.
Usage
ud.convert(x, u1, u2)
Arguments
x
Some argument which is convertible to a numeric type by as.double.
u1
A character string which is parseable into a udunits compatible unit.
u2
Another character string which is also parseable into a
udunits compatible unit and for which there exists a defined
transformation from the units represented by u1.
Details
This function uses the udunits function cv_convert_doubles to
convert the argument from one set of units to another.
Value
Returns a numeric type having converted from one unit to another. The
attributes of the original argument x (e.g. class, dimensions,
etc.) are preserved and then re-applied to the return value of the
transformation as such:
attributes(rv) <- attributes(x)
If either of unit u1 or u2 is unparseable, or there does
not exist a conversion from one to the other the function raises an error.