[R] Relative subscripting

Tobias Muhlhofer t.muhlhofer at lse.ac.uk
Tue Nov 30 21:45:40 CET 2004


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.

Thanks,
	Toby




More information about the R-help mailing list