By default such values are removed before processing. To put it simply all you need to do is divide the number of items in the set by the sum of their reciprocals. The function mean is used to calculate this in R.
Where n is number of items and X1X2 are the numbers from 1 to n.
The number of elements will be averaged and divided by the sum of the reciprocals of the elements. Program to calculate Root Mean Square. So the average rate of the milk in rupeesliter is 12953491609077956 13 RsLiter Approx We get this answer from Harmonic mean calculated in Python. M ˇ i 1 N T N 0 1 x i N T N 0 1 N T N 0 N T where m ˇ is harmonic mean x i is a nonzero value of the data vector N T is the total sample size N 0 is the number of zero values.