Description Usage Arguments Value Author(s) References Examples
View source: R/temperature_unit_convertion.R
This function allows you to convert a vector of temperature values between Fahrenheit, Celsius, and degrees Kelvin.
1 2 3 4 5 6 7 8 9 10 11 12 13 | convert_temperature(temperature, old_metric, new_metric)
celsius.to.fahrenheit(T.celsius)
celsius.to.kelvin(T.celsius)
fahrenheit.to.celsius(T.fahrenheit)
fahrenheit.to.kelvin(T.fahrenheit)
kelvin.to.celsius(T.kelvin)
kelvin.to.fahrenheit(T.kelvin)
|
temperature |
A numeric vector of temperatures to be converted. |
old_metric |
The metric from which you want to convert. Possible options are:
|
new_metric |
The metric to which you want to convert. The same options
are possible as for |
T.kelvin, T.fahrenheit, T.celsius |
Numeric vector of temperatures in Kelvin, Fahrenheit and Celsius. |
A numeric vector with temperature converted to the metric specified
by the argument new_metric
.
A numeric vector of temperature values in the new unit.
Joshua Ferreri joshua.m.ferreri@gmail.com, Brooke Anderson brooke.anderson@colostate.edu, Roger Peng rdpeng@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | data(lyon)
lyon$TemperatureF <- convert_temperature(lyon$TemperatureC,
old_metric = "c", new_metric = "f")
lyon
data(norfolk)
norfolk$TempC <- convert_temperature(norfolk$TemperatureF,
old_metric = "f", new_metric = "c")
norfolk
data(angeles)
angeles$TemperatureC <- convert_temperature(angeles$TemperatureK,
old_metric = "kelvin", new_metric = "celsius")
angeles
# Convert from Celsius
data(lyon)
lyon$TemperatureF <- celsius.to.fahrenheit(lyon$TemperatureC)
lyon$TemperatureK <- celsius.to.kelvin(lyon$TemperatureC)
lyon
# Convert from Fahrenheit
data(norfolk)
norfolk$TempC <- fahrenheit.to.celsius(norfolk$TemperatureF)
norfolk$TemperatureK <- fahrenheit.to.kelvin(norfolk$TemperatureF)
norfolk
# Convert from Kelvin
data(angeles)
angeles$TemperatureC <- kelvin.to.celsius(angeles$TemperatureK)
angeles$TemperatureF <- kelvin.to.fahrenheit(angeles$TemperatureK)
angeles
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.