Module # 2 assignment

 

Module # 2 assignment

Download Download the outline instructions on how to import  download data to RStudioReview Chapter # 1 - Dalgaard's Introductory Statistics with R and Matloff - The Art of R programming  Chapter 1-3 

Evaluate the following function call myMean. The data for this function called assignment. The assignment contains the following data:  6181422271719222022
> assignment2<- c(6,18,14,22,27,17,22,20,22)

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

# Assign data to a vector

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


# Calculate the mean

myMean <- function(assignment2) {

  return(sum(assignment2) / length(assignment2))

}

# Call the function and store the result

result <- myMean(assignment2)


# Print the result

print(result)

[1] 18.7


assignment2 is a vector having a set of numbers (6, 18, 14, 22, 27, 17, 19, 22, 20, 22). It provides the data for calculating the average using the myMean function.

Comments

Popular posts from this blog

The Final project in this class

Module # 8 Assignment

Module # 6 assignment