One can calculate the absolute humidity (AH) from the relative
humidity (r) using three equations: (1) the equation for mixing
ratio, (2) an equation for relative humidity expressed in terms of
mixing ratio, and (3) the Clausius-Clapeyron equation, which
relates saturation vapor pressure to temperature.
The result of combining the three equations is:
AH = (1324 r/T) [exp {5417.75 (1/273 - 1/T)}]
where AH is expressed in grams per cubic meter, T is temperature
in Kelvin, r is relative humidity (range is 0 to 1), and the
relation holds true for T>273. For T<273, replace 5417.75
with 6139.81.