I'm using the CRRBinomialTreeOption function (in package "fOptions") with a loop for pricing a large number of options. But I can't transfer the values obtained from this function to a "numeric" matrix as the outcome of this function is not a simple numeric.
The following is the piece of code: # USING THE FUNCTION library(fOptions) option.price<-matrix(nrow=250,ncol=9) for(j in 1:9){for(i in 1:250) {option.price[i,j]=CRRBinomialTreeOption(TypeFlag="ca",S=data[(i+250),j],X=data[j,19],Time=T[i,j],r=data[i ,(9+j)],b=0,sigma=sig[i,j],n=5)}} R output: Error in option.price[i, j] = CRRBinomialTreeOption(TypeFlag = "ca", S = data[(i + : object of type 'S4' is not subsettable I'm very new to R and can't find a solution with my knowledge at this moment. Plz help. -- View this message in context: http://r.789695.n4.nabble.com/Help-required-binomial-option-pricing-using-package-tp3162935p3162935.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.