Learn R Programming

dynamicGraph (version 0.1.6.6)

blockTreeToList: Extract the list of blocks from a block tree

Description

Returns the list of blocks from a block tree.

Usage

blockTreeToList(tree)

Arguments

tree
The BlockTree part of the result of setTreeBlocks.

Value

  • A list of blocks, each block of class BlockProto.

Examples

Run this code
Block.tree <- list(label = "W", Vertices = c("contry"),
                   X = list(Vertices = c("sex", "race"),
                            A = list(Vertices = c("hair", "eye"),
                                     horizontal = FALSE),
                            B = list(Vertices = c("age"),
                                     C = list(Vertices = c("education")))))
Names <- unlist(Block.tree)
Names <- Names[grep("Vertices", names(Names))]
Types <- rep("Discrete", length(Names))
vertices <- returnVertexList(Names, types = Types)
blocktree <- setTreeBlocks(Block.tree, vertices)
Labels(blockTreeToList(blocktree$BlockTree))

Run the code above in your browser using DataLab