Hi,

say I have a xts object x with data I want to apply a function f over row by
row (by.column=F)

x =
index c1 c2  c3
1       1   1    0
2       2   2    0
3       3   3    0
4       4   4    0
5       5   5    0

what i would like to do and i am not sure that that is possible is the
following

the result of operating on one row is put in the last column of x of that
same row
and is used in the operation on the next row, where f is some non-trivial
function of the columns

So for example the simple function summing over the row
and normalizing by the previous value of the last columns value in the
previous row
(first row does not normalize here)

x =
index c1 c2   c3
1       1   1    2      = 1+1
2       2   2    2      = 2/2+2/2 = 2
3       3   3    3      = 3/2+3/2 = 3
4       4   4    8/3   = 4/3+4/3
5       5   5    15/4 = 5/8*3+5/8*3

Is there some way to sneak this into rollapply?
Maybe I am asking too much, but if somebody
can enlighten it would be greatly appreciated
Thanks!
Jiri

	[[alternative HTML version deleted]]

