Computes the mass of a given chemical formula based either on the exact mass or the average mass of its constituent elements.
calculate_mass(formula, which = c("exact_mass", "average_mass"))A numeric value representing the computed mass of the given chemical formula based on the specified type (exact or average).
Calculate Mass of a Chemical Formula
This function computes the mass of a given chemical formula based on either exact or average mass of its constituent elements.
calculate_mass("H2O") # Using default exact_mass
#> H2O
#> 18.01056
calculate_mass("H2O", which = "average_mass")
#> H2O
#> 18.016
calculate_mass("C6H12O6", which = "exact_mass")
#> C6H12O6
#> 180.0634