assignment2<- c(6,18,14,22,27,17,22,20,22)
myMean <- function(assignment2) {return(sum(assignment2)/length(assignment2))}
myMean(assignment2)
This is a representation of the function “myMean”. It takes a vector, in this case “assignment2”, and gives the output of the sum of that vector and then divides it by the length of the vector.
Leave a comment