2

In R,using dplyr package, I tried the function "summarise" and I expect the result to show along with the groupby field. However, all of a sudden I see summarized output but without the groupby filed which makes the results meaningless. Any one any idea?

For example if data has ages and salaries for members belonging to a team and I try to view the Average Age and Salary by Team the code below returns just the averages without the team names

Code: 
df_summ = df %>% group_by(Team)%>% summarise(AvgAge= mean(Age),AvgSalary= mean(Salary)) 

So without the groupby column "Team" the result is meaningless

What Am I missing here?

Toros91
  • 2,392
  • 3
  • 16
  • 32

0 Answers0