[R] vectorizing an iterative process.

Geoffrey Zhu gzhu at peak6.com
Tue Dec 26 16:33:49 CET 2006


Hi Everyone,
 
I am stuck with a simple problem. Suppose I have a vector x, and I want
to calculate y[i]=3Dx[i+1]-x[i], it is very easy. I just need to write
y<-x[2:length(x)]-x[1:length(x)-1]. 
 
Now if I know y, and want to know the vector x defined by
x[i]=3Dx[i-1]+y[i-1] for all i, how can I do this without a loop? 
 
Thanks,
Geoffrey

PS. Sorry if you see a duplicate message. The previous one was in a
weird format that most people would not be able to read.

_______________________________________________________=0A=
=0A=
=0A=
The information in this email or in any file attached hereto is=0A=
intended only for the personal and confidential use of the individual=0A=
or entity to which it is addressed and may contain information that is=0A=
proprietary and confidential. If you are not the intended recipient of=0A=
this message you are hereby notified that any review, dissemination,=0A=
distribution or copying of this message is strictly prohibited. This communi=
cation is for information purposes only and should not be regarded as an off=
er to sell or as a solicitation of an offer to buy any financial product. Em=
ail transmission cannot be guaranteed to be secure or error-free.



More information about the R-help mailing list