[R] Relative subscripting

Kjetil Brinchmann Halvorsen kjetil at acelerate.com
Tue Nov 30 22:44:57 CET 2004


Tobias Muhlhofer wrote:

> Hi!
>
> I'm trying to do the following.
>
> I have monthly a dataset with, among other things, "marketcap", and 
> "return".
>
> I want to multiply return by the marketcap of the previous month. How 
> do I do this?
>
> In STATA (which I have used frequently in the past) I would simply use 
> an expression of the form
>
> return[_n]*marketcap[_n-1]
>
> I believe they call this relative subscripting. Is there something 
> like this in R?
>
> On a completely different note, are there books on R? I read the 
> "Getting Started" notes, but, while helpful, I would need more than 
> those.

Q 2.7 in the R faq (yes, there are many)!

Kjetil

>
> Thanks,
>     Toby
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>
>


-- 

Kjetil Halvorsen.

Peace is the most effective weapon of mass construction.
               --  Mahdi Elmandjra




More information about the R-help mailing list