我想允许用户扩展我在包中定义的引用类。这是一个玩具示例:
# 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’
如何摆脱此警告?
答案 0 :(得分:1)
请记住从包中导出类定义,在my_package / NAMESPACE文件中添加
exportClasses("Main")