I created the following function:
我创建了以下功能:
nDone<- function (under,strike,ttoe,vol,rf,dy) pnorm(((log(under/strike)+
(rf-dy+(vol^2)/2)*ttoe)/(vol*(ttoe^0.5))))
Then I call the function with the following:
然后我用以下函数调用该函数:
nDone(90,100,3,0.17,0.05,0)
Result
结果
[1] 0.6174643
Ok so far were all good.
好到目前为止都很好。
Now I create a vector with the same values in an object:
现在我在对象中创建一个具有相同值的向量:
d<- c(90,100,3,0.17,0.05,0)
and I try to call the function using the object.
我尝试使用该对象调用该函数。
nDone(d)
And I get the following error.
我收到以下错误。
Error in under/strike : 'strike' is missing
What am I doing wrong and how to fix?
我做错了什么以及如何解决?
Thanks
谢谢
RSG
RSG
1 个解决方案
#1
28
Try this
尝试这个
do.call(nDone, as.list(d))
#1
28
Try this
尝试这个
do.call(nDone, as.list(d))