Learn R Programming

RMassBank (version 2.0.0)

order.formula: Order a chemical formula correctly

Description

Orders a chemical formula in the commonly accepted order (CH followed by alphabetic ordering).

Usage

order.formula(formula, as.formula = TRUE, as.list = FALSE)

Arguments

formula
A molecular formula in string or list representation ("C6H6" or list(C=6,H=6)).
as.formula
If TRUE, the return value is returned as a string. This is the default.
as.list
If TRUE, the return value is returned in list representation.

See Also

list.to.formula, add.formula, is.valid.formula

Examples

Run this code

#
order.formula("H4C9")
order.formula("C2N5HClBr")

Run the code above in your browser using DataLab