[R] Recursive solution with for()

Owe Jessen jessen at econinfo.de
Thu Dec 20 19:29:28 CET 2007


Hello,

i just ran into the following problem: I wanted to recursively solve 
equations of the type x_1[t]=x_1[t+1]+beta*x_2[t], and used a for-loop 
written

for(j in c(1:t-1, recursive=TRUE){
...
}

This didn't work, so i resolved to writing
for(j in c(10,9,...,1){

which worked, but is not terribly efficient. So, what did I do wrong?

Thanks in advance,
Owe

-- 
Owe Jessen
Diplom-Volkswirt
Hanssenstraße 17
24106 Kiel

jessen at econinfo.de
http://www.econinfo.de



More information about the R-help mailing list