Module #2 Post

Hello, world!


This week's assignment was to evaluate the following function/code.


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

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

# This function does not work because of several reasons. 

# First reason is someData is not defined

# Second is that the varible names are different within the function,

# 'assignment2' does not equal assignment.

# Third is that the function is not called. 

# Below I have fixed the function.


someData <- c(4)

myMean2 <- function(var) { return(sum(var)/length(someData)) }

myMean2(assignment2)

Please see my Github!

https://github.com/Midiquin/LIS4370.720S21/blob/main/Mod2.R

Comments

Popular posts from this blog

Module #4

Module #6