Re: [R] tapply on multiple groups

2010-01-28 Thread David Winsemius


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



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


Data frame has one measure (Days) and two Dimensions (MM and  
Place). All

have the same length.


length(dbs.final$Days)

[1] 3306

length()

[1] 3306

length()

[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 ~ MM | Place, ,data=dbs.final)

Is there an equivalent to the | operation in tapply?


Please reread the help page for tapply.

Perhaps?:

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

-- David



--
View this message in context: 
http://n4.nabble.com/tapply-on-multiple-groups-tp1380593p1380593.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] tapply on multiple groups

2010-01-28 Thread Gigi Lipori
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. 

 David Winsemius dwinsem...@comcast.net 1/28/2010 11:49 AM 

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


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

 Data frame has one measure (Days) and two Dimensions (MM and  
 Place). All
 have the same length.

 length(dbs.final$Days)
 [1] 3306
 length()
 [1] 3306
 length()
 [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 ~ MM | Place, ,data=dbs.final)

 Is there an equivalent to the | operation in tapply?

Please reread the help page for tapply.

Perhaps?:

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

-- David


 -- 
 View this message in context: 
 http://n4.nabble.com/tapply-on-multiple-groups-tp1380593p1380593.html 
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help 
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 
 and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.