s-news
[Top] [All Lists]

Re: Query: generalising tapply to calculate cross sectional correlati

To: Glenn.Treacy@ILIM.COM
Subject: Re: Query: generalising tapply to calculate cross sectional correlati
From: james.holtman@convergys.com
Date: Thu, 25 Nov 2004 14:53:43 -0500
Cc: s-news@lists.biostat.wustl.edu, s-news-owner@lists.biostat.wustl.edu



I tend to do tapply/lapply on the indices in these cases:
tapply(seq(nrow(jj.df)), jj.df$Date, function(x) cor(jj.df$RANK1[x],
y=jj.df$RANK2[x]))
__________________________________________________________
James Holtman        "What is the problem you are trying to solve?"
Executive Technical Consultant  --  Office of Technology, Convergys
james.holtman@convergys.com
+1 (513) 723-2929


                                                                                
                                                               
                      Glenn.Treacy@ILIM.COM                                     
                                                               
                      Sent by:                         To:       
s-news@lists.biostat.wustl.edu                                                
                      s-news-owner@lists.biosta        cc:                      
                                                               
                      t.wustl.edu                      Subject:  [S] Query: 
generalising tapply to calculate cross sectional correlati ons     
                                                                                
                                                               
                                                                                
                                                               
                      11/25/2004 12:51                                          
                                                               
                                                                                
                                                               
                                                                                
                                                               




Hi,

I would be surprised if there is not a very neat way of doing this in S+
but
I'm stuck.

I have a data frame with a number of observations at each time point and
several attributes for each observation. At each point in time these
attributes are ranked and I want to get the cross correlation at each point
in time. My first effort was

tapply(jj.df$RANK1, list(jj.df$DATE),cor, y=jj.df$RANK2)

This doesn't work because RANK2 has not been segmented by jj.df$DATE where
jj.df$RANK1 has. Any pointers would be greatly appreciated.

Regards,
Glenn Treacy


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept
for the presence of computer viruses.
**********************************************************************

--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news




<Prev in Thread] Current Thread [Next in Thread>
  • Re: Query: generalising tapply to calculate cross sectional correlati, james . holtman <=