Hi all,
as I am trying to move slowly from just "working" to "good" code, I'd
like to ask if there's a smarter way than using a for-loop in tasks like
the example below.
I need to obtain the extrema of the cumulated sum of a detrended time
series. The following code is currently used, please have
I think you only have to calculate
X.cum.sum[1:i]-seq(1:i)*X.cum.mean[i]
once for the entire vector since it appears that you are just computing it
over and over again for lengthing vectors. Here I have just computed it
once and then did a running min/max on the data. This should run faster:
Forget this. I missed the single index on X.cum.mean[i]!!
On 3/12/07, jim holtman <[EMAIL PROTECTED]> wrote:
>
> I think you only have to calculate
>
> X.cum.sum[1:i]-seq(1:i)*X.cum.mean[i]
>
> once for the entire vector since it appears that you are just computing it
> over and over again for le