R Programming Assignment #2

For this assignment we were asked to evaluate the function called myMean.

As you can see, the output of the function is correct. This function was successful because the structure of the function code was the correct syntax in R. The function had its name (myMean), a body(assignment2), and a set of arguments { return(sum(assignment2)/length(assignment2)) }.

It is important to understand that this function would also work if we used it with a different vector. For example if I had a vector called “assignment1” with different values, the function would still be able to produce the accurate mean. In order to better display this ability, next time I would replace “assignment2” with “x” in my function code. This way it is clear that any numeric variable can be used within this function.

Here I have provided my GitHub repository where my code can also be viewed:

https://github.com/mramalho4/rprog-repo.git

Leave a comment