2
我想允許用戶擴展我在包中定義的引用類。這裏是一個玩具例子:如何擴展R包中定義的引用類?
# my_package/R/Main.R
#' My Main class
#' @export
Main <- setRefClass("Main")
加載此包後,我得到一個警告,當我試圖把它擴大:
library(my_package)
Child <- setRefClass("Child", contains = "Main")
# Warning message:
# Class "Main" is defined (with package slot ‘my_package’) but no metadata object found to revise subclass information---not exported? Making a copy in package ‘.GlobalEnv’
如何擺脫這個警告?
哎呀,我用的是'export',而不是'exportClass'。謝謝 – nachocab