看不到method/function时如何查看代码?
How to view the code when no method/function is visible?
此题与this相似。我想弄清楚函数的作用,但我仍然看不到 SharpeR:::as.markowitz
的源代码。
我试过了,没有成功:
getAnywhere("as.markowitz")
getS3method("as.markowitz")
methods("as.markowitz","SharpeR")
methods(class="as.markowitz")
methods("as.markowitz")
还有其他方法可以看到源码吗?
这是因为 as.markovitz
的方法没有在包命名空间中正确注册。通常,这应该有效:
with(asNamespace("SharpeR"), methods("as.markowitz"))
使用ls
列出包中的所有函数,get
显示代码:
ls(asNamespace("SharpeR"), all = TRUE)
get("as.markowitz.default", asNamespace("SharpeR"))
此题与this相似。我想弄清楚函数的作用,但我仍然看不到 SharpeR:::as.markowitz
的源代码。
我试过了,没有成功:
getAnywhere("as.markowitz")
getS3method("as.markowitz")
methods("as.markowitz","SharpeR")
methods(class="as.markowitz")
methods("as.markowitz")
还有其他方法可以看到源码吗?
这是因为 as.markovitz
的方法没有在包命名空间中正确注册。通常,这应该有效:
with(asNamespace("SharpeR"), methods("as.markowitz"))
使用ls
列出包中的所有函数,get
显示代码:
ls(asNamespace("SharpeR"), all = TRUE)
get("as.markowitz.default", asNamespace("SharpeR"))