search for: nextinitial

Displaying 1 result from an estimated 1 matches for "nextinitial".

Did you mean: getinitial
2009 Jul 18
1
apply/return and reuse
...00 10400 In real usage the function would obviously do a lot more work, but the question I cannot answer myself yet is whether the apply can return a value from the work on one row and then use that value as the input to the function for the next row? Thanks, Mark ReturnLast = function (.row, NextInitial=100) { .row$Initial = as.numeric(NextInitial) .row$Final = as.numeric(.row$Initial+100) } MyStart = 10000 X = data.frame(cbind(Event = 1:10, Initial = 0, Final = 0)) X MyStart = apply(X, 1, ReturnLast( X, MyStart)) X