Module # 2 Introduction to basic R functions and Data Structures
Module # 2 Introduction to Basic R functions and Data Structures
Your assignment, evaluate the following function call myMean. The data for this function called assignment.
> assignment2 <- c(16, 18, 14, 22, 27, 17, 19, 17, 17, 22, 20, 22)
>myMean <- function(assignment2) { return(sum(assignment2)/length(assignment2)) }
> YOUR turn...
Post the result of testing this function on your blog and your GitHub. Plus, provide reference and explanation as to why this function works or does not work?
This is a screenshot of my console on R studio. From here you can see the values that fall under assignment2. This function takes the sum of all of the values of assignment2, which is 231, and divides them by the length, or total number of values found in assignment2, which is 12. This provides a result of 19.25. This result confirms that the myMean function does work.
16 +18+14+22+27+17+19+17+17+22+20+22 = 231
231/12 = 19.25
or
https://github.com/AlenjaksAbraham/LIS4370.git
My github has a repository under LIS4370. I pushed a Module 2 Read me.md and Module 2 R Makrdown.Rmd. With this, you are able to see my code.
Comments
Post a Comment