print.parentslist: Print a parentslist object

View source: R/8-conversion-functions.R

as.character.parentslistR Documentation

Print a parentslist object

Description

Nice print of a parentslist object

Usage

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

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

Arguments

x

an object of class parentslist.

only_parents

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

...

additional arguments for compatibility.

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.

Examples

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

stagedtrees documentation built on April 29, 2022, 1:06 a.m.