Skip to content
Prev 127256 / 398500 Next

How to speed up multiple for loop over list of data frames

On Oct 17, 2007, at 4:36 PM, James wrote:

            
I guess in answer to my own question I found that on page 46 of  "An  
Introduction to R" it describes this usage:

 > for (i in 1:length(yc)) {
plot(xc[[i]], yc[[i]]);
abline(lsfit(xc[[i]], yc[[i]]))
}

So in my case that turns into:

y<-numeric(length(x))
for(i in 1:length(x)) {
      y[i]<-GBSGreeks(Selection = 'delta', TypeFlag="c", S=x[i],  
X=20, Time=.0000001, r=.05, b=.05, sigma=0.4)
}

Sorry for the noise.

James