Takes a chemical formula string and breaks it down into its individual elemental components and their respective counts.

split_formula(formula = "C9H11NO2")

Arguments

formula

A character string representing a chemical formula (e.g., "C9H11NO2"). Default is "C9H11NO2".

Value

A data frame with two columns: `element.name` contains the elemental symbols and `number` contains the respective counts for each element in the formula.

Examples

split_formula(formula = "C9H11NO2")
#>   element.name number
#> 2            C      9
#> 3            H     11
#> 4            N      1
#> 5            O      2
split_formula(formula = "CH3")
#>   element.name number
#> 2            C      1
#> 3            H      3