Skip to content

Aggregating data (with more than one function)

1 message · Robin Schroeder

#
Dear list & Andy, 

I am hopelessly stumped, how would one add the department names as a variable?

Robin
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Liaw, Andy
Sent: Monday, March 28, 2005 6:45 PM
To: 'Sivakumaran Raman'; r-help at stat.math.ethz.ch
Subject: RE: [R] Aggregating data (with more than one function)


Here's one possible way, using the data you supplied:
total=sum(x))))
            mean  total
Finance 83925.67 251777
HR      63333.33 190000
IT      59928.67 179786
Sales   62481.67 187445

If you need the department names as a variable, you can add that easily.

HTH,
Andy
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html