[R] summary statistics for groups

Kirsten Beyer kirsten-beyer at uiowa.edu
Mon Jul 16 17:48:12 CEST 2007


I have a list of ICD9(disease) codes and associated exposure measures.
 I am interested in a script that would calculate the mean exposure
for each ICD9 code and the combined mean for all other codes excluding
that code, then attaching those measures, and a count of how many
numbers were included in each average, to a table of unique ICD9
codes, such that the final table would look like this:

ICD9 code     ave_exposure     ICD9count     otherICD9_ave_exposure
 otherICD9_count

I have been using the gsummary function in the nlme package.

Thanks!



More information about the R-help mailing list