Omar Lakkis wrote:
Is there a way to implement this faster than doing it in a loop.
for (i in length(settle)-1:1) {
settle[i] = settle[i+1]/(1 + settle.pct[i+1])
}
You dont need a loop at all here. How so? Well, as it is written the
code in the for loop only exec
It is, backwards, a cumulative product so you could use cumprod.
On Wed, 11 May 2005, Omar Lakkis wrote:
Is there a way to implement this faster than doing it in a loop.
for (i in length(settle)-1:1) {
settle[i] = settle[i+1]/(1 + settle.pct[i+1])
}
I want to guarantee
On Wed, 11 May 2005 13:05:58 -0400 Omar Lakkis wrote:
> Is there a way to implement this faster than doing it in a loop.
>
> for (i in length(settle)-1:1) {
> settle[i] = settle[i+1]/(1 + settle.pct[i+1])
> }
>
> I want to guarantee that i+1 is calculated before
Is there a way to implement this faster than doing it in a loop.
for (i in length(settle)-1:1) {
settle[i] = settle[i+1]/(1 + settle.pct[i+1])
}
I want to guarantee that i+1 is calculated before i
__
R-help@stat.math.et