Before you intend to do an operation, you can filter the dataset. The dataset starts in 1871, and the analysis does not need the years prior to 1980.
data % > %
filter(yearID > 1980) % > %
group_by(yearID) % > %
summarise(mean_game_year = mean(G))
- filter(yearID > 1980): Filter the data to show only the relevant years (i.e. after 1980)
- group_by(yearID): Group by year
- summarise(mean_game_year = mean(G)): Summarize the data