Hi,

Thanks for your replies.

In summary:

1.   Replace code with c(0, cumsum(diff(theoP)) ).   This is indeed correct
and I had not realized it !!

>> d = vector(mode = "numeric", length= len)
>> d[1] = 0
>> if (len>1) for (i in 2:len) { d[i] = d[i-1] + theoP[i] - theoP[i-1] }

2.  How to create recursive vector, eg. vector = previous vector * new_data
... suggested to look at the filter() function.

Thanks for your replies.

Cheers,
Chris

--
View this message in context: 
http://r.789695.n4.nabble.com/Replace-for-loop-when-vector-calling-itself-tp3338383p3339938.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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.

Reply via email to