문제

I want to allow users to extend a reference class I define in my package. Here is a toy example:

# my_package/R/Main.R
#' My Main class
#' @export
Main <- setRefClass("Main")

After loading this package, I get a warning when I try to extend it:

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’

How do I get rid of this warning?

도움이 되었습니까?

해결책

Remember to export the class definition from your package, in the my_package/NAMESPACE file add

exportClasses("Main")
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top