mean is a function that calculates the average of a vector of values.
Click to see solution
Many R functions have the
na.rm argument available.
This argument is "a logical value indicating whether NA values should be stripped before the computation proceeds. (Citation)