for
loop.myMean
functionWrite a function named myMean
that uses
a for
loop to calculate the mean of a vector of
numbers.
Recall that the mean is:
\[ \bar{x} = \frac{\sum_{i=1}^n{x_i}}{n} \]
for
loop to add up a vector of
numbers. DO NOT USE THE SUM FUNCTION IN YOUR CODE!mean
function in
base R.