A function to validate chemical formulas based on the list of recognized chemical elements as of 2022.
Character string representing the chemical formula to be checked.
Logical. Returns `TRUE` if the formula is valid and `FALSE` otherwise.
Check Validity of a Chemical Formula
Determines the validity of a chemical formula based on the known chemical elements up to 2022. The function checks whether all the symbols in the formula belong to the list of known chemical elements. It doesn't consider charges or other non-element symbols in the formula.
is_valid_chemical_formula("H2O") # TRUE #>  TRUE is_valid_chemical_formula("C6H12O6") # TRUE #>  TRUE is_valid_chemical_formula("H2ZO4") # FALSE #>  FALSE