Learn R Programming

stagedtrees (version 2.3.0)

as.character.parentslist: Print a parentslist object

Description

Nice print of a parentslist object

Usage

# S3 method for parentslist
as.character(x, only_parents = FALSE, ...)

# S3 method for parentslist print(x, ...)

Value

as.character.parentslist returns a string encoding the associated directed graph and eventually the context specific independences. The encoding is similar to the one returned by modelstring in package bnlearn

and package deal. In particular, parents of a variable can be enclosed in:

  • ( ) if a partial (conditional) independence is present.

  • { } if a context specific independence is present.

  • < > if no context specific and partial (conditional) independences are present, but at least a local independence is detected.

If a parent is not enclosed in parenthesis the dependence is full.

If only_parents = TRUE, the simple DAG encoding as in bnlearn

is returned.

Arguments

x

an object of class parentslist.

only_parents

logical, if the basic DAG encoding is to be returned.

...

additional arguments for compatibility.

Examples

Run this code
model <- stages_hclust(full(Titanic), k = 2)
pl <- as_parentslist(model)
pl
as.character(pl)
as.character(pl, only_parents = TRUE)

Run the code above in your browser using DataLab