conv_ppm | R Documentation |
Converts concentrations given as ppm to mg/m3. The unit ppm is ambiguous as the number of parts in a volume depends on air pressure and temperature.
conv_ppm(dt, idcol, meascols, temp = 25, pressure = 1.01325 * 10^5)
dt |
(data.table) A data.table with gas concentrations expressed in ppm. |
idcol |
(character) Column to identify unique measurements, most likely you will want to use Timestamp for this |
meascols |
(character) A character vector with columns that need converting, only columns that contain just one of following gases in column name work: co2, h2o, nh3, or n2o |
temp |
(numeric) Temperature in degrees C during measurement default = 25C |
pressure |
(numeric) Air pressure in Pa, default is 1 atmosphere (1.01325*10^5) |
To convert a concentration ppm (parts per million) with a unit as mol/mol to a concentration mg/m3 (mass/volume) one needs the molar volume, number of moles and molar mass of a gas. The number of moles of a gas is derived from the ideal gas law (we assume our converted gasses are ideal gasses): n = PV/R/T Where P = pressure (Pa) V = volume R = the universal gas constant T = temperature (k)
by multiplying the concentration ppm with n and the molar mass we gain our concentration in mg/m3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.