DescTools (version 0.99.8.1)

UnitConv: Unit Conversion

Description

Simple function for common unit conversions.

Usage

UnitConv(x, from_unit, to_unit)

data(d.units)

Arguments

x
the numeric to be converted.
from_unit
a character defining the original unit.
to_unit
a character defining the target unit.

Details

The following units can be choosen. If a conversion can't be found the function will return NA. ll{ unit description a year (assuming 365.25 days per year) AA 1 angstrom = 100 pm atm atmosphere (standard) bar bar cal calorie C Celsius d day eV electronvolt F Fahrenheit ft foot = 12 inches g gram, the SI unit of mass (although the definition is based on kg) gal U.S. Gallon h hour hp horsepower (metric) in inch (strangely, some people still use these) J Joule, the Si unit of energy l litre lb international avoirdupois pound m metre, the SI unit of length m3 cubic metre mi mile = 5280 feet min minute oz ounce Pa Pascal, the SI unit of pressure psi pound-force per square inch s second, the SI unit of time tn metric ton toe 1 toe = 1000 kgoe = 1000 kg * 35 MJ/kg = 35000 MJ (energy as tons of oil equivalent) ton metric ton W Watt, the SI unit of power Wh 1 Wh = 1 Wh * 3600 s/h = 3600 Ws = 3600 MJ yd yard (basic unit of length) } All the details can be found in the d.units data.frame.

Examples

Run this code
UnitConv(c(1.2, 5.4, 6.7), "in", "m")

Run the code above in your browser using DataLab