10
我創建一個包和S3方法我導出它們使用如何導出S3方法,使其在命名空間中可用?
##' @method predict myclass
##' @export
predict.myclass <- function(object,...) { }
現在,當我加載包,然後predict
作品的類myclass
的對象,但功能predict.myclass
不出口。在NAMESPACE中,我只能得到條目S3method(predict,myclass)
。那麼是否還有辦法導出predict.myclass
,以便用戶在控制檯中寫predict.myclass
時可以獲得代碼predict.myclass
?
好的,所以這裏是另一個問題http://stackoverflow.com/questions/18513607/how-to-extend-s3-method-from-another-package-without-loading-the-package。我認爲我解決了我的問題,增加了出口。 – mpiktas
你確定嗎? [根據哈德利](https://cran.r-project.org/web/packages/roxygen2/vignettes/namespace.html),*每個S3方法必須導出*。也許我誤解你的答案。 –
@StéphaneLaurentOP已經有了'S3method(predict,myclass)',這是必要和充分的;也許這就是哈德利所說的「必須出口」。既不需要也不推薦'export(predict.myclass)'。 –