ListFormula: Convert an Elemental Formula to a List

Description Usage Arguments Details Author(s) See Also Examples

View source: R/ListFormula.R

Description

Convert a character string representing an elemental formula to a list representing the elemental formula. The list can be used as input to other functions.

Usage

1
ListFormula(elemental.formula)

Arguments

elemental.formula

character string representing the elemental formula.

Details

To maintain compatibility with MolecularWeight, MonoisotopicMass, and IsotopicDistribution the elemental formula can contain only C,H,N,O,S,P,Br,Cl,F,Si, and Sn (Sn is a default element in MolecularWeight only). Elements not in this set will be ignored and a warning will be generated. The function can handle repeated elements, but not element multiplication indicated by parenthesis.

Known issue: Lower case letters after numbers, such as the “o” in “C12oBr5H5” will not be caught with a warning and the resulting list will contain the incorrect number of elements.

Author(s)

Nathan G. Dodder

See Also

ConvertPeptide

Examples

1
2
ListFormula("C14H8Cl4")
ListFormula("C6H5OH")

Example output

Loading required package: grid
$C
[1] 14

$H
[1] 8

$N
[1] 0

$O
[1] 0

$S
[1] 0

$P
[1] 0

$Br
[1] 0

$Cl
[1] 4

$F
[1] 0

$I
[1] 0

$Si
[1] 0

$Sn
[1] 0

$C
[1] 6

$H
[1] 6

$N
[1] 0

$O
[1] 1

$S
[1] 0

$P
[1] 0

$Br
[1] 0

$Cl
[1] 0

$F
[1] 0

$I
[1] 0

$Si
[1] 0

$Sn
[1] 0

OrgMassSpecR documentation built on May 2, 2019, 6:48 p.m.