I am trying to create a package in R where I created many new custom classes. Each class is in a different file. Classes inherit from the parent class and inherit other classes.
During the launch of my codes, I call them each of them
source("package/father.R") source("package/son.R") source("package/grandson.R")
Defining some methods needed for a grandson class defined in the Sleep class. I use package.skeleton () to call each one of them and create a package, and it seems to work fine. But when R CMD Check starts (and when trying to install it in R), it gives an error, because the function tries to call the files in alphabetical order, and therefore the grandson.R file is called before son.R, and it shows, and the error says that the methods not defined. If I change the names to zgrandson.R, R named this file last, and everything seems to work fine, but this obviously is not the solution.
I read tutorials for creating packages, but they all seem to be dealing with simple cases where inheriting / finding other files in R. I hope I made it clear.
inheritance class r packages
Alex joseph
source share