Nov 14, 2019 in R Language
Q: Filter in R Language

1 Answer

0 votes
Nov 14, 2019

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
Nov 14, 2019 in R Language
0 votes
Nov 14, 2019 in R Language
...