#==================== # R function to calculate molar mass # of any chemical compound. Argument x # contains the number of atoms of each # element in the compound, and argument # y contains the corresponding atomic # weights of those elements. #==================== molar.mass=function(x,y) { mm=sum(x*y) return(mm) }