Posts

Showing posts from August, 2023

Assignment 2

 Assignment 2  The function myMean calculates the average of all numbers in assignment2 vector. It does so by summing up all of the values in assignment2 and divides them by the number of elements in the vector. The sum of all the values in assignment 2 equals to 168. Dividing that number by the amount of elements , 9, the total comes out to be approximately 18.67 mean = sum of elements/ number of elements  Here are my results:  assignment2 <- c ( 6 , 18 , 14 , 22 , 27 , 17 , 22 , 20 , 22 ) myMean <- function (assignment2) { return ( sum (assignment2) / length (assignment2))} myMean (assignment2) ## [1] 18.66667