-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
  • 899
  • 7
  • 19
Renin RK
  • 91
  • 1
  • 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,274
  • 7
  • 23