Consider the following vectors representing the number of field goals made and attempted by a basketball player in five games:
Field Goals Made: c(8, 7, 6, 9, 10) Field Goals Attempted: c(15, 12, 18, 14, 13)
Calculate the field goal percentage for each game and select the correct average field goal percentage for the five games.
fg_made<- c(8, 7, 6, 9, 10)
fg_attempted<- c(15, 12, 18, 14, 13)
fg_made
## [1] 8 7 6 9 10
fg_attempted
## [1] 15 12 18 14 13
#field goal percentage for each game
fg_percentage<- (fg_made/fg_attempted)
fg_percentage
## [1] 0.5333333 0.5833333 0.3333333 0.6428571 0.7692308
#average field goal percentage for the five games
fg_percentage_avg<- mean(fg_percentage)
fg_percentage_avg
## [1] 0.5724176