[R] Relative subscripting

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Wed Dec 1 09:00:22 CET 2004


On 01-Dec-04 Uwe Ligges wrote:
> (Ted Harding) wrote:
>> [...]
>> Let
>> 
>>   N<-length(return)
>>   new.var <- return[2:N]*marketcap[1:(N-1)]
> 
> Ted, I aggree to all of your points, but we can simplify by negative 
> indices (and hence circumvent your note 1):
>   return[-1] * marketcap[-N]
> 
> Uwe Ligges

Neat footwork, Uwe!
(Why didn;t I think of that? No, don't answer ... )
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861  [NB: New number!]
Date: 01-Dec-04                                       Time: 08:00:22
------------------------------ XFMail ------------------------------




More information about the R-help mailing list