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. Also known as "moisture content".
Function uses calcMR
Note
This function requires the calcMR
function to be available in the environment.
Examples
# Humidity ratio at 20°C (Temp) and 50% relative humidity (RH)
calcHR(20, 50)
#> [1] 7.260814
# mydata file
filepath <- data_file_path("mydata.xlsx")
mydata <- readxl::read_excel(filepath, sheet = "mydata", n_max = 5)
mydata |> dplyr::mutate(HumidityRatio = calcHR(Temp, RH))
#> # A tibble: 5 × 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 5.96
#> 2 London Room 1 2024-01-01 00:15:00 21.8 36.7 5.94
#> 3 London Room 1 2024-01-01 00:29:59 21.8 36.6 5.92
#> 4 London Room 1 2024-01-01 00:44:59 21.7 36.6 5.89
#> 5 London Room 1 2024-01-01 00:59:59 21.7 36.5 5.87