molMass: Calculate Molar Mass of Compound

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/molMass.R

Description

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

Usage

1
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.

Value

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

Author(s)

Charlotte Rennuit and Sasha D. Hafner

References

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

See Also

calcCOD

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  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')

biogas documentation built on Jan. 8, 2020, 5:08 p.m.