mz_atomize: Parse a molecular formula into element and count

Description Usage Arguments Value Examples

View source: R/mz_atomize.R

Description

mz_atomize separates a molecular formula into element and count, returning a named vector of element counts.

Usage

1
mz_atomize(molecule)

Arguments

molecule

A string containing a molecular formula (e.g., "C2H7NO3S"). Structural formulas containing parentheses are not acceptable. Charges may be included, but the charge count should follow the sign (e.g., "C10H16N5O13P3-3").

Value

A vector of counts named by element.

Examples

1
2
3
mz_atomize("C5H8O5-")
mz_atomize("C2H7NO3S")
mz_atomize("C10H16N5O13P3-3")

wmoldham/mzrtools documentation built on Oct. 26, 2020, 2:40 p.m.