Categories

Nov 14, 2019 in R Language

Q: Multiple groups in R language

1 Answer

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
Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

Madanswer
Nov 14, 2019 in R Language
Nov 14, 2019 in R Language
Nov 14, 2019 in R Language
...