The `qty`

function makes it easy to keep track of different quantities in chemical calculations. Metric prefixes are fully supported, i.e. any unit can be combined with standard metric scaling (mL, nmol, kg, etc.). Some quantities can also be used in common arithmetic operations.

qty(x, unit, scale_to_best_metric = TRUE) is_qty(q) is_amount(q) is_mass(q) is_molecular_mass(q) is_molarity(q) is_density(q) is_volume(q) is_pressure(q) is_solubility(q) is_temperature(q)

x | the numeric value of the quantity, can be a single value or a vector |
---|---|

unit | the unit of the quantity |

scale_to_best_metric | whether to automatically scale to the best metric prefix |

q | a quantity object |

*amount*: base unit `mol`

but also understands `mole`

, all metric prefixes allowed

*mass*: base unit `g`

, all metric prefixes allowed

*molecular mass*: base unit `g/mol`

, all metric prefixes allowed in the numerator

*concentration (molarity)*: base unit `M`

but also understands `mol/L`

, all metric prefixes allowed in the numerator

*concentration (density)*: base unit `g/L`

but also understands `g/l`

, all metric prefixes allowed in the numerator

*volume*: base unit `L`

but also understands `l`

, all metric prefixes allowed

*pressure*: base unit `bar`

but also understands `Pa`

, all metric prefixes allowed, the common non-metric units `atm`

, `psi`

, `Torr`

, `mTorr`

, and `% SP`

(% at standard pressure = % of 1 bar) are also supported and will be automatically converted to `bar`

.

*Henry's law solubility constant*: base unit `M/bar`

, all metric prefixes allowed in the numerator, the common non-metric unit `M/atm`

is also supported and will be automatically converted to `M/bar`

.

*temperature*: base unit `K`

but also understands `C`

and `F`

and converts them to Kelvin

`qty`

: generate a quantity object`is_qty`

: check whether something is a quantity`is_amount`

: check whether something is an amount quantity`is_mass`

: check whether something is an amount quantity`is_molecular_mass`

: check whether something is a molecular mass quantity`is_molarity`

: check whether something is a molarity quantity`is_density`

: check whether something is a density quantity`is_volume`

: check whether something is a volume quantity`is_pressure`

: check whether something is a pressure quantity`is_solubility`

: check whether something is a solubility quantity`is_temperature`

: check whether something is a temperature quantity

Other quantity functions: `metric`

,
`quantity_info`

qty(0.045, "mmol/L")#> Molarity [µM] #> [1] 45qty(200, "mbar")#> Pressure [mbar] #> [1] 200qty(6, "psi")#> Pressure [mbar] #> [1] 413.6855qty(30, "C")#> Temperature [K] #> [1] 303.15qty(100, "K")#> Temperature [K] #> [1] 100qty(5, "mg/L")#> Density [mg/L] #> [1] 5qty(1, "mM/bar")#> Solubility [mM/bar] #> [1] 1qty(257, "g/mol")#> MolecularMass [g/mol] #> [1] 257