Function to calculate humidity ratio (g/kg) from temperature (°C) and relative humidity (%).
Humidity ratio is the mass of water vapor present in a given volume of air relative to the mass of dry air.
Function uses calcMR
Details
The function uses the following steps:
1. Calculate the mixing ratio using the calcMR
function.
2. Convert the mixing ratio to humidity ratio using the formula:
HR = MR / (1 + MR)
Where MR is the mixing ratio and HR is the humidity ratio.
Note: This function requires the calcMR
function to be available in the environment.
Examples
calcHR(20, 50)
#> [1] 0.8789858
head(mydata) |> dplyr::mutate(HumidityRatio = calcHR(Temp, RH))
#> # A tibble: 6 × 6
#> Site Sensor Date Temp RH HumidityRatio
#> <chr> <chr> <dttm> <dbl> <dbl> <dbl>
#> 1 London Room 1 2024-01-01 00:00:00 21.8 36.8 0.856
#> 2 London Room 1 2024-01-01 00:15:00 21.8 36.7 0.856
#> 3 London Room 1 2024-01-01 00:29:59 21.8 36.6 0.856
#> 4 London Room 1 2024-01-01 00:44:59 21.7 36.6 0.855
#> 5 London Room 1 2024-01-01 00:59:59 21.7 36.5 0.855
#> 6 London Room 1 2024-01-01 01:14:59 21.7 36.2 0.853