convert_temperature {weathermetrics} | R Documentation |
This function allows you to convert a vector of temperature values between Fahrenheit, Celsius, and degrees Kelvin.
convert_temperature(temperature, old_metric, new_metric, round = 2)
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 |
round |
An integer indicating the number of decimal places to round the converted value. |
A numeric vector with temperature converted to the metric specified
by the argument new_metric
.
#' Joshua Ferreri joshua.m.ferreri@gmail.com, Brooke Anderson brooke.anderson@colostate.edu
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