Skip to contents

pasteElements creates a chemical formula from element counts (such as returned by countElements()).

Usage

pasteElements(x)

Arguments

x

list/integer with element counts, names being individual elements.

Value

character() with the chemical formulas.

See also

Author

Michael Witting and Sebastian Gibb

Examples


elements <- c("C" = 6, "H" = 12, "O" = 6)
pasteElements(elements)
#> [1] "C6H12O6"