Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/formulaCalculator.R
Converts molecular formulas from string to list representation or vice versa.
1 2 3 |
formula |
A molecular formula in string format, e.g. |
flist |
A molecular formula in list format, e.g. |
The function doesn't care about whether your formula makes sense. However,
"C3.5O4"
will give list("C" = 3, "O" = 4)
because regular
expressions are used for matching (however, list("C" = 3.5, "O" = 4)
gives "C3.5O4"
.) Duplicate elements cause problems; only "strict"
molecular formulas ("CH4O", but not "CH3OH") work correctly.
list.to.formula
returns a string representation of the
formula; formulastring.to.list
returns the list representation.
Michael Stravs
add.formula
, order.formula
,
is.valid.formula
1 2 3 4 5 | #
list.to.formula(list("C" = 4, "H" = 12))
# This is also OK and useful to calculate e.g. adducts or losses.
list.to.formula(list("C" = 4, "H" = -1))
formulastring.to.list(list.to.formula(formulastring.to.list("CHIBr")))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.