-1

I have a data like this:

enter image description here

I want to find the average salary of all employees- As, Bs, Cs and Ds. I would like to know if there is any short cut to do the same as the number of employees is very large in my dataset. I tried using if else, but it turned out to be impractical. Do let me know if the same can be done in any other programming language.

Mesut Akcan
  • 900
  • 7
  • 18
Renin RK
  • 81
  • 1
  • 6

1 Answers1

1

It is very easy in R. Assuming your file is saved as data.csv then

df = read.csv("data.csv")
sapply(split(df$Salary, df$Name), mean)
James Curran
  • 1,212
  • 7
  • 21