Learn R Programming

eva3dm (version 1.11)

rh2q: Convert relative humidity to absolute humidity

Description

function to convert humidity to absolute humidity using Tetens formula, assuming standard atmosphere conditions.

Usage

rh2q(rh, temp = 15)

Value

value of data.frame with time and the absolute humidity, units are g/g

Arguments

rh

vector (or data.frame) of relative humidity (in percentage)

temp

vector (or data.frame) of temperature (in Celsius)

Examples

Run this code
# for a singfle value
rh2q(rh = 99, temp = 25)

# vector of rh values
rh2q(rh = c(0,seq(1,100, by = 4)), temp = 25)

# vector of values for rh and temp
rh2q(rh = c(0,seq(1,100, by = 4)), temp = 10:35)

# rh is data.frame and temp is a value
times <- seq(as.POSIXct('2024-01-01',tz = 'UTC'),
             as.POSIXct('2024-01-02',tz = 'UTC'),
             by = 'hour')
rh2q(rh   = data.frame(time = times, a = seq(1,100, by = 4)),temp = 25)

# using both rh and temp are data.frames
rh2q(rh   = data.frame(time = times, a = seq(1,100, by = 4)),
     temp = data.frame(time = times, a = 11:35))

Run the code above in your browser using DataLab