For this assignment, the functions being evaluated were assignment2<- c(6,18,14,22,27,17,22,20,22) and myMean <- function(assignment2) {return(sum(assignment2)/length(assignment2))}.
The expectations for this assignment were to use the data set from the function assignment2 to return the mean value. I was unsuccessful in running this calculation using R, however I understand completely how and why the code outlined here is designed to run. Writing out assignment 2 using this format initializes the value for the function; assignment2= the values listed within the parentheses. I'm not sure why it's called myMean or if it serves a different purpose than simply "mean", but this function is designed to calculate the mean of the input vector (assignment2). By using 'function' this inputs the integers from the data set as the values for the calculations; the sum of the dataset(assignment2) divided by the length (number of entries within the data set) returns the mean. I'm still figuring out what went wrong during my attempts to fulfill this task, I spent multiple hours combing through videos and the textbooks to get a grasp on the introductory materials and still failed to run this code.
No comments:
Post a Comment