Learn R Programming

SciencesPo (version 1.3.9)

converter: Unit Converter

Description

Converts data from a numeric value from one measurement system to another. For instance, distances in miles to kilometers.

Usage

converter(x, from, to)

Arguments

x
A numeric value or vector of data values to be converted.
from
A character defining the original unit.
to
A character defining the target unit.

encoding

UTF-8

Details

NA is returned if a conversion cannot be found. lll{ Weight and mass Gram g metric Slug sg Pound mass (avoirdupois) lbm U (atomic mass unit) u Ounce mass (avoirdupois) ozm Distance Meter m metric Statute mile mi Nautical mile Nmi Inch in Foot ft Yard yd Angstrom ang metric Pica pica Time Year yr Day day Hour hr Minute mn Second sec Pressure Pascal Pa (or p) Atmosphere atm (or at) mm of Mercury mmHg Force Newton N metric Dyne dyn (or dy) Pound force lbf Energy Joule J metric Erg e Thermodynamic calorie c IT calorie cal metric Electron volt eV (or ev) metric Horsepower-hour HPh (or hh) Watt-hour Wh (or wh) metric Foot-pound flb BTU BTU (or btu) Power Horsepower HP (or h) Watt W (or w) metric Magnetism Tesla T metric Gauss ga metric Temperature Degree Celsius C (or cel) Degree Fahrenheit F (or fah) Kelvin K (or kel) metric Liquid measure Teaspoon tsp Tablespoon tbs Fluid ounce oz Cup cup U.S. pint pt (or us_pt) U.K. pint uk_pt Quart qt Gallon gal Liter l (or lt) metric }

Examples

Run this code
converter(c(5.6, 6.7), "in", "m")

Run the code above in your browser using DataLab