This reporter takes a package and traces the class inheritance structure. Currently the following object-oriented systems are supported:

  • S4 Classes

  • Reference Classes (sometimes informally called "R5")

  • R6 Classes

S3 classes are not supported, as their inheritance is defined on an ad hoc basis per object and not formally by class definitions.

Note the following details about class naming:

  • Reference Classes : The name passed as Class in setRefClass is used as the node name by this reporter. This is the class name that is used when specifying inheritance. The generator object returned by setRefClass does not have to be assigned and can have a different name.

  • R6 Classes : The name of the generator object in the package namespace is used as the node name by this reporter. The generator object returned by R6::R6Class is what is used when specifying inheritance. The name passed as classname passed to R6::R6Class can be a different name or even NULL.

For more info about R's built-in object-oriented systems, check out the relevant chapter in Hadley Wickham's Advanced R. For more info about R6, check out their docs website or the chapter in Advanced R's second edition.

InheritanceReporter

Format

An object of class R6ClassGenerator of length 24.

Public Methods

set_package(pkg_name, pkg_path)

  • Set properties of this reporter. If pkg_name overrides a previously-set package name, any cached data will be removed.

  • Args:

    • pkg_name: String with the name of the package.

    • pkg_path: Optional directory path to source code of the package. It is used for calculating test coverage. It can be an absolute or relative path.

See also