Skip to content

tapply on multiple groups

3 messages · GL, David Winsemius, Gigi Lipori

GL
#
Can you make tapply break down groups similar to bwplot or such? Example:

Data frame has one measure (Days) and two Dimensions (YYYYMM and Place). All
have the same length.
[1] 3306
[1] 3306
[1] 3306

Doing the following makes a nice table for one dimension and one measure:

    do.call(rbind,tapply(dbs.final$Days,dbs.final$Place, summary))

But, what I really need to do is break it down on two dimensions and one
measures - effectively equivalent to the following bwplot call:

    bwplot( Days ~ YYYYMM | Place, ,data=dbs.final)

Is there an equivalent to the "|" operation in tapply?
#
On Jan 28, 2010, at 10:26 AM, GL wrote:

            
Please reread the help page for tapply.

Perhaps?:

tapply(dbs.final$Days, list(dbs.final$YYYYMM, dbs.final$Place) summary)

-- David
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
#
Thanks. My mistake was that I used c(dbs.final$Days,dbs.final$Place) instead of list(... when I tried to follow that part of the documentation.

        
On Jan 28, 2010, at 10:26 AM, GL wrote:

            
Please reread the help page for tapply.

Perhaps?:

tapply(dbs.final$Days, list(dbs.final$YYYYMM, dbs.final$Place) summary)

-- David
David Winsemius, MD
Heritage Laboratories
West Hartford, CT