Question

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?

Was it helpful?

Solution

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

exportClasses("Main")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top