Re: [R] Recursive solution with for()

From: Christos Hatzis <christos_at_nuverabio.com>
Date: Thu, 20 Dec 2007 13:58:19 -0500

It not entirely clear, but I think that you are looking for

seq(t-1, 1)

-Christos

> -----Original Message-----
> From: r-help-bounces_at_r-project.org
> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Owe Jessen
> Sent: Thursday, December 20, 2007 1:29 PM
> To: R-help_at_stat.math.ethz.ch
> Subject: [R] Recursive solution with for()
>
> 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
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 20 Dec 2007 - 19:03:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 20 Dec 2007 - 20:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.