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,352
  • 3
  • 14
  • 31
  • 1
    Make sure package ‘plyr’ wasn’t loaded first. ‘Summarize’ is overloaded if plyr is loaded first and it doesn’t yield the same result – HEITZ May 08 '18 at 22:09
  • It sure was something to do with the version of the package dplyr. I noticed that my R server had 3 versions of dplyr sitting in packages .... clicking and Un-clicking a few versions of dplyr did the job and then I could see the groupby field appear again.... Thank you HEITZ For your reply – snehal sharma May 09 '18 at 22:44

0 Answers0