Simple call to mean with the na.rm option set to TRUE.
na.rm
naMean(x)
x
The arithmetic mean of the values in x.
mean(c(1,2,3,NA),na.rm=TRUE) naMean(c(1,2,3,NA))