Skip to contents

Constructs and initialises a tree from a data frame that is already in memory, where the hierarchy is defined in a relational (ID/parent) format.

Usage

load_tree_df(df)

Arguments

df

A data frame with columns: id, name, question, rule, parent.

Value

A data.tree object, fully constructed and initialised with answer and confidence attributes set to NA.

Details

This is a core constructor function. It may be used to load one of the example datasets in relational format. It is called by the load_tree_csv() wrapper, which handles reading the data from a file.

See also

load_tree_csv() to read this format from a file.

Examples

# Load a tree from the 'ethical' dataframe included in this package
ethical_tree <- load_tree_df(ethical)

# View the tree structure
if (FALSE) { # \dontrun{
print_tree(ethical_tree)
} # }