Re: [R] how to do away for loop using functionals?

2015-10-14 Thread Annie Hawk via R-help
ply(1:ng, function(i) {                      lapply(i0[i]:ng, function(j) {                                 ok <- !is.na(match(g, i:j))                                 B[i, j] <<- getResult(df[ok, ])                             })                  })) B all.equal(A, B) On Mon, Oct 12, 2

[R] how to do away for loop using functionals?

2015-10-12 Thread Annie Hawk via R-help
HI R-experts, I am trying to speed up my calculation of the A results below and replace the for loop withsome functionals like lapply.  After manyreadings, trial and error, I still have no success.  Would anyone please give me some hints onthat?  Thank you in advance. Anne  The program i