summary.staged_tree {stCEG} | R Documentation |
Summarise a Staged Tree Object
Description
Provides a visual and textual summary of a staged tree object, including counts of nodes and edges, node colour distributions, and uncoloured nodes in intermediate levels.
Usage
## S3 method for class 'staged_tree'
summary(object, ...)
Arguments
object |
An object of class |
... |
Additional arguments (currently unused). |
Details
This function #prints a summary that includes:
Total number of nodes and edges.
Number of nodes still uncoloured (white) that are not in the first or last level.
A count of nodes by hex colour, optionally with coloured terminal output using the
crayon
package.The prior table if it exists.
If the crayon
package is available, the function displays background colour blocks in the console to represent node colours.
Value
Invisibly returns a list containing summary components:
-
num_nodes
: Total number of nodes in the staged tree. -
num_edges
: Total number of edges in the staged tree. -
num_uncoloured_middle
: Number of white nodes not in the first or last level. -
color_counts
: A named table of node colour frequencies. -
priortable
: The prior table, if available; otherwiseNULL
.
Also prints a human-readable summary to the console.
Note
White-coloured nodes (#FFFFFF
) that are not in the minimum or maximum level are flagged as "Nodes left to be coloured."
Examples
data <- homicides
event_tree <- create_event_tree(data, columns = c(1,2,4,5), "both")
coloured_tree <- ahc_colouring(event_tree)
tree_priors <- specify_priors(coloured_tree, prior_type = "Uniform", ask_edit = FALSE)
staged_tree <- staged_tree_prior(coloured_tree, tree_priors)
homicides_ST_summary <- summary(staged_tree)