Evaluating Functions: myMean

September 5, 2025

For this assignment, we were given the data assignment2  which contained a list of numberic values, as well as the function myMean, both displayed below.

After importing both into RStudio:

  • the vector assignment2   appears in the Environment tab as a dataset containing 9 numerical values
  • the function myMean is stored 

When running the function myMean(assignment2), R returns the value 18.66667. It executes 2 basic operations: adding all the values in the dataset using sum(), and then dividing the sum by the number of values in the dataset, using /length(). The result is the average, or mean of the dataset.