Open pkshen opened 6 years ago
You will create a new variable for average strike-outs per game. This is calculated at the team level.
ave.so <- Teams$SO / Teams$G
Then to calculate the league average over time, you will need to average all of the new ave.so variables by year. You can either use tapply()
or group_by()
plus summarize()
to calculate the average league stats by year.
In lab 6 question 3, how to calculate the league average? I thought is league average=R/G, is that correct?