Вопрос

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