[R] Stratified data summaries

David Winsemius dwinsemius at comcast.net
Sun Jul 12 17:10:47 CEST 2009


On Jul 9, 2009, at 6:52 PM, Hayes, Rachel M wrote:
> I'm trying to automate a data summary using summary or describe from  
> the
> HMisc package.  I want to stratify my data set by patient_type.  I was
> hoping to do something like:
>
>
>
> Describe(myDataFrame ~ patient_type)
>

> by(myDataFrame, patient_type, describe)


Or:

Describe.by <- function(.df, .categ) { by( .df, .categ, describe) }

>
>
> I can create data subsets and run the describe function one at a time,
> but there's got to be a better way.  Any suggestions?
>

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list