Module #2 Assignment

9/4/23

 This week I evaluated the functions:

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

myMean <- function(assignment2){return(sum(assignment2)/length(assignment2))}


The first creates a vector called assignment2. Second, a function to find mean is assigned to 'myMean'. In this function, the sum of all the numbers in the vector is calculated with sum(assignment2) and then divided by the number of elements in the vector with length(assignment2). When this function is called with the assignment 2 vector, it returns the mean which is 18.667. 

Comments

Popular posts from this blog

Module #11 Assignment

Module #12 Assignment

Module #9 Assignment