Module #2: Calculating Vector Mean

Calculating Vector Mean


The R script creates the myMean function, which computes the average of the assignment2 vector. The sum(assignment2) code calculates the total of each component in the vector assignment2. Using the formula, length(assignment2), the vector's length, or the number of assignment2's elements, is determined. The mean is then calculated by dividing the sum of the elements by the length of the vector.



The assignment2 vector's mean value is around 18.66667.

Comments

Popular posts from this blog

LIS 4370: Module # 10 Building your own R package

LIS 4317 Final Project: Fuel Economy Data from the U.S Dept. of Energy

LIS 4317: Module # 10 assignment