Learn R Programming

biogas (version 1.0.1)

molMass: Calculate Molar Mass of Compound

Description

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

Usage

molMass(form)

Arguments

form
a chemical formula, as a character vector of length one, e.g., "C6H12O6" for glucose or "CH3COOH" for acetic acid. Not case-sensitive for single letter elements (see 'Details').

Value

  • Length one numeric vector with molar mass (g/mol)

concept

  • biogas
  • chemistry

Details

Atomic weights are from CIAAW, and were rounded to four digits or more if possible. molMass can handle two letter elements (see 'Examples') but in this case form is case-sensitive.

References

CIAAW

See Also

calcCOD

Examples

Run this code
molMass("C6H12O6")
  molMass("CH3COOH")
  molMass("CH3CH2OH")
  molMass("CH4")
  molMass("ch4")

  # Case-sentitive for two letter elements
  molMass("NaHCO3")

Run the code above in your browser using DataLab