molMass function

Calculate Molar Mass of Compound

Calculate Molar Mass of Compound

molMass calculates the molar mass of any organic compound (and some salts) based on its chemical formula.

molMass(form)

Arguments

  • form: a chemical formula, as a character vector, e.g., "C6H12O6" for glucose or "CH3COOH" for acetic acid, or c("C6H12O6", "CH3COOH") for both at once.

Details

Standard atomic weights are from CIAAW, and were rounded to three or more digits (with the exception of Li) depending on the range of the reported interval for normal materials . In general form should follow capitalization rules for elements (i.e., first letter capitalized, second lower-case). However, if form contains single-letter elements only, it is possible to use lower-case letters for all elements (but for clarity this is not recommended). The function is vectorized.

Returns

Numeric vector with length equal to length of form with molar mass (g/mol)

References

CIAAW http://www.ciaaw.org/atomic-weights.htm

Author(s)

Charlotte Rennuit and Sasha D. Hafner

See Also

calcCOD

Examples

molMass("C6H12O6") molMass("CH3COOH") molMass("CH3CH2OH") molMass("CH4") molMass("ch4") molMass(c("C6H12O6", "CH3COOH", "CH3CH2OH")) # Case-sentitive for two letter elements molMass("NaHCO3") # Complex formulas OK molMass("H3C(CH2)5COOH") molMass("(C6H12O6)0.24999 (H3COOH)0.75001") # Database is quite complete molMass('CdSiO3') # Use care for, e.g., hydrates molMass('FeSO4(H2O)7')
  • Maintainer: Sasha D. Hafner
  • License: GPL-2
  • Last published: 2024-12-05

Useful links