
Loveland$Precip.cm <- convert_precip(loveland$Precip.mm, Old_metric = "mm", new_metric = "inches", round = NULL) Loveland$Precip.in <- convert_precip(loveland$Precip.mm, When round is set to NULL, the output value will not be rounded. The default value for round is 1, consistant with the algorithms used by the National Oceanic and Atmospheric Administration’s online wind speed conversion (accessed February 22, 2016). You can specify the number of decimal places you wish to round to using the round argument. The unit for old_metric cannot be the same as the unit for new_metric. You must specify the unit of wind speed that you wish to convert from using the old_metric option, and the unit of wind speed you wish to convert to using the new_metric option (possible values: 'knots', 'mph', 'mps', 'ftps', or 'kmph'). Therefore, heat index values from the function will sometimes differ by one or two degrees compared to other heat index calculators or charts.įoco$mph <- convert_wind_speed(foco$knots, old_metric = "knots",įoco$kmph <- convert_wind_speed(foco$mph, old_metric = "mph", However, heat index is sometimes calculated using a simpler algorithm. Therefore, results should agree with results from the US National Weather Service online calculator. The algorithm for calculating heat index is adapted for R from the algorithms used by the United States National Weather Service’s online heat index calculator (accessed December 18, 2015). If this is not the case, you can use convert_temperature to convert one of the metrics before using heat.index. When calculating heat index from air temperature and dew point temperature, both must be input in the same metric (either degrees Fahrenheit or degrees Celsius). Lyon$HI_F <- heat.index( t = lyon$TemperatureC, You can use this data to calculate daily heat index values in degrees Fahrenheit using: You can choose which metric for heat index output using using the tric option (the default is to give heat index in the same metric as the air temperature values input to the function).Īs another example, the lyon data set gives daily values of air temperature ( lyon$TemperatureC) and dew point temperature ( lyon$DewpointC), both in degrees Celsius. You must specify whether the air temperature input to the function is in degrees Celsius or Fahrenheit using the tric option (possible values: 'fahrenheit' or 'celsius'). Suffolk # Date TemperatureF Relative.Humidity HI

Suffolk$HI <- heat.index( t = suffolk$TemperatureF,


Since this data set includes values for both temperature and relative humidity, you can calculate dew point temperature using the humidity.to.dewpoint function: If input values for temperature and dew point temperature are in different metrics (i.e., one is in degrees Fahrenheit and the other in degrees Celsius), you must convert one of the inputs using either celsius.to.fahrenheit or fahrenheit.to.celsius before you can input the values to the dewpoint.to.humidity function.Īs an example of calculating dew point temperature, the newhaven data set gives daily values of air temperature in degrees Fahrenheit ( newhaven$TemperatureF) and relative humidity in % ( newhaven$Relative.Humidity). You should specify whether air temperature and dew point temperature inputs are in degrees Fahrenheit or Celsius using the tric argument (possible values are 'fahrenheit' and 'celsius'). Lyon$RH <- dewpoint.to.humidity( t = lyon$TemperatureC, The convert_temperature function is a wrapper function for a variety of individual temperature conversion functions, including: celsius.to.fahrenheit, fahrenheit.to.celsius, celsius.to.kelvin, kelvin.to.celsius, fahrenheit.to.kelvin, and kelvin.to.fahrenheit functions, which you can use individually if you would like. The input for old_metric should be the temperature measure that you want to convert from, and the input for new_metric should be the temperature measure you wish to convert to.

You can specify whether air temperature and dew point temperature inputs are in degrees Celsius, Fahrenheit, or Kelvin using the old_metric and new_metric options (possible values are 'celsius', 'fahrenheit', 'kelvin', or 'c', 'f', and 'k' for the same). Old_metric = "kelvin", new_metric = "celsius")Īngeles$DewpointC <- convert_temperature(angeles$DewpointK,Īngeles # date TemperatureK DewpointK TemperatureC DewpointC #Convert from degrees Kelvin to degrees Celsius data(angeles)Īngeles$TemperatureC <- convert_temperature(angeles$TemperatureK,
