Module #2


3. Your assignment, evaluate the following function call myMean. The data for this function called assignment

The myMean function successfully calculates the mean of the assignment2 vector. Sum divided by the length of the vector returns the mean.

 assignment2 <- c(16, 18, 14, 22, 27, 17, 19, 17, 17, 22, 20, 22)


myMean <- function(assignment2) {

  return(sum(assignment2) / length(assignment2))

}


myMean(assignment2)


> myMean(assignment2)
[1] 19.25


Comments