Question 16
Given a vector goals <- c(2, 3, 1, 0, 4,2,0,1,4,3) that represents the number of goals scored per game, answer the following questions. After completing this activity using RStudio share the link or upload your file to Canvas.
1.What is the total number of goals scored? 2.What is the average number of goals scored per game? 3.What is the maximum number number of goals scored in a single game? 4.What is the minimum number of goals scored in a single game?
goals <- c(2, 3, 1, 0, 4,2,0,1,4,3)
1.What is the total number of goals scored?
total_goals <- sum(goals)
total_goals
## [1] 20
2.What is the average number of goals scored per game?
average_goals<-mean(goals)
average_goals
## [1] 2
3.What is the maximum number number of goals scored in a single game?
max_goal<- max(goals)
max_goal
## [1] 4
4.What is the minimum number of goals scored in a single game?
min_goal <- min(goals)
min_goal
## [1] 0