Computes the mass of a given chemical formula based either on the exact mass or the average mass of its constituent elements.
get_mass(formula, which = c("exact_mass", "average_mass"))
Character string representing the chemical formula for which the mass is to be computed.
Character string indicating the type of mass to be computed. Possible values are "exact_mass" or "average_mass". Default is "exact_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.
get_mass("H2O") # Using default exact_mass
#> H2O
#> 18.01056
get_mass("H2O", which = "average_mass")
#> H2O
#> 18.015
get_mass("C6H12O6", which = "exact_mass")
#> C6H12O6
#> 180.0634