add.formula: Calculations on molecular formulas

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

View source: R/formulaCalculator.R

Description

Add, subtract, and multiply molecular formulas.

Usage

1
2

Arguments

f1, f2

Molecular formulas (in list form or in text form) to calculate with.

as.formula

Return the result as a text formula (e.g. "C6H12O6"). This is the default

as.list

Return the result in list format (e.g. list(C=6, H=12, O=6)).

n

Multiplier (positive or negative, integer or non-integer.)

Details

Note that the results are not checked for plausibility at any stage, nor reordered.

Value

The resulting formula, as specified above.

Author(s)

Michael Stravs

See Also

formulastring.to.list, is.valid.formula, order.formula

Examples

1
2
3
4
5
##

add.formula("C6H12O6", "C3H3")
add.formula("C6H12O6", "C-3H-3")
add.formula("C6H12O6", multiply.formula("C3H3", -1))

sneumann/RMassBank documentation built on Oct. 20, 2020, 3:19 p.m.