Nov 14, 2019 in R Language
Q: Multiple groups in R language

1 Answer

0 votes
Nov 14, 2019

A summary statistic can be realized among multiple groups.

# Multiple groups
data % > %
	group_by(yearID, teamID) % > %
	summarise(mean_games = mean(G)) % > %
	arrange(desc(teamID, yearID))

Code Explanation

  • group_by(yearID, teamID): Group by year and team
  • summarise(mean_games = mean(G)): Summarize the number of game player
  • arrange(desc(teamID, yearID)): Sort the data by team and year

Related questions

0 votes
Nov 14, 2019 in R Language
0 votes
Nov 14, 2019 in R Language
...