0 votes
in R Language by
Filter in R Language

1 Answer

0 votes
by

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.

# Filter
data % > %
	filter(yearID > 1980) % > %
	group_by(yearID) % > %
	summarise(mean_game_year = mean(G))

Code Explanation

  • 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

Related questions

0 votes
asked Nov 14, 2019 in R Language by MBarbieri
0 votes
asked Nov 14, 2019 in R Language by MBarbieri
...