Skip to contents

Convert a chemical molecule into its constituent elements with its respective counts as a dictionary.

Usage

get_elements(molecule)

Arguments

molecule

string

Value

dictionary

Examples

get_elements("(C2H4)5")
#>   element count
#> 1       C    10
#> 2       H    20
get_elements("Al2(SO4)3")
#>   element count
#> 1      Al     2
#> 2       S     3
#> 3       O    12