View source: R/conversion-conc.R
convert_conc | R Documentation |
This function converts between volume and mass concentration by standard conditions. The constants used are equivalent to the one used in AIRMO for sites below 1500m a.s.l:
R = 8.314151 [kg * m2 / (s2 * mol * K)] T = 20.00 [°C] p = 1013.00 [hPa] mol masses: CO = 28.01 [g / mol] NO = 30.01 [g / mol] NO2 = 46.01 [g / mol] O3 = 48.00 [g / mol] SO2 = 64.06 [g / mol]
It is possible to change this constants via functions during run time for a session. See convert_set_R()
,
convert_set_mol_masses()
, convert_set_conc_lookup()
convert_conc(data, parameter, from, to, method = "return", ...)
convert_conc_multiple(data, conversions, method = "return", ...)
data |
containing the parameter to convert |
parameter |
to convert |
from |
start unit |
to |
target unit |
method |
one of "return", "append", "replace". "return" only returns the converted data, "append" appends the converted data at the end, "replace" replaces the original data for the parameter with the converted |
... |
addional parameters passed to conversion function. see |
conversions |
tibble with columns paramter, from, to. each row is a conversion |
converted data
parts_to_mass()
mass_to_parts()
purrr::partial()
min30 <- system.file("extdata", "Zch_Stampfenbachstrasse_min30_2013_Jan.csv",
package = "rOstluft.data", mustWork = TRUE)
airmo_min30 <- read_airmo_csv(min30)
convert_conc(airmo_min30, "NO", "\u00b5g/m3", "ppb", method = "return")
conversions <- tibble::tribble(
~parameter, ~from, ~to,
"CO", "ppm", "mg/m3",
"NO", "ppb", "\u00b5g/m3",
"O3", "ppb", "\u00b5g/m3",
"NO2", "ppb", "\u00b5g/m3",
"SO2", "ppb", "\u00b5g/m3"
)
min30 <- system.file("extdata", "Zch_Stampfenbachstrasse_min30_2013_Jan.csv",
package = "rOstluft.data", mustWork = TRUE)
airmo_min30 <- read_airmo_csv(min30)
airmo_min30_parts <- dplyr::filter(airmo_min30, .data$unit == "ppb" | .data$unit == "ppm")
convert_conc_multiple(airmo_min30_parts, conversions, method = "return")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.