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.

Details

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.

Class Constructor

  • Initialize an instance of the reporter.

  • Returns:

    • Instantiated reporter object. Note that this reporter object isn't useful yet until you use the set_package method to set a package.

Public Methods

set_package(pkg_name, pkg_path = NULL)

  • Set the package that the reporter will analyze. This can only be done once for a given instance of a reporter. Instantiate a new copy of the reporter if you need to analyze a different package.

  • Args:

    • pkg_name: character string, name of package

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

  • Returns:

    • Self, invisibly.

get_summary_view()

  • Returns an htmlwidget object that summarizes the analysis of the reporter. Used when creating a package report.

  • Returns:

calculate_default_measures()

  • Calculates the default node and network measures for this reporter.

  • Returns:

    • Self, invisibly.

Public Fields

pkg_name

character string, name of set package. Read-only.

report_markdown_path

character string, path to R Markdown template for this reporter. Read-only.

nodes

a data.table, containing information about the nodes of the network the reporter is analyzing. The node column acts the identifier. Read-only.

edges

a data.table, containing information about the edge connections of the network the reporter is analyzing. Each row is one edge, and the columns SOURCE and TARGET specify the node identifiers. Read-only.

network_measures

a list, containing any measures of the network calculated by the reporter. Read-only.

pkg_graph

a graph model object. See DirectedGraph for additional documentation. Read-only.

graph_viz

a graph visualization object. A visNetwork::visNetwork object. Read-only.

layout_type

a character string, the current layout type for the graph visualization. Can be assigned a new valid layout type value. Use use grep("^layout_\\S", getNamespaceExports("igraph"), value = TRUE) to see valid options.

Special Methods

clone(deep = FALSE)

  • Method for copying an object. See Advanced R for the intricacies of R6 reference semantics.

  • Args:

    • deep: logical. Whether to recursively clone nested R6 objects.

  • Returns:

    • Cloned object of this class.

See also

Other Network Reporters: DependencyReporter, FunctionReporter

Other Package Reporters: DependencyReporter, FunctionReporter, SummaryReporter