Enter Interactive Analysis Mode
andorR_interactive.Rd
Iteratively prompts the user to answer questions to solve a decision tree. The function first presents the most impactful unanswered questions. Once the tree's root is solved, it presents questions that can increase the overall confidence of the conclusion.
Arguments
- tree
The
data.tree
object to be analysed.- sort_by
A character string indicating how the prioritised questions should be sorted. Options are:
"TRUE" : Sort by the product of the node true_index for all ancestors, which measures the influence of the question if it is answered TRUE
"FALSE" : Sort by the product of the node false_index for all ancestors, which measures the influence of the question if it is answered FALSE
"BOTH" : (Default) Sort by the sum of 'TRUE' and 'FALSE' values which measures the aggregate influence of the question before the answer is known
Details
This function provides a command-line interface (CLI) for working with the
tree. It uses the cli
package for formatted output and handles user input
for quitting, saving, printing the tree state, or providing answers to
specific questions (either by number or by name). All tree modifications are
performed by calling the package's existing API functions:
The following key commands may be used during interactive mode:
h : Show the help screen
p : Print the current state of the tree
s : Save the current state of the tree to an .rds file
q : Quit (exit interactive mode)
n : Specify a node to edit by name (case sensitive)
1, 2, ... : Specify a node to edit from the numbered list
Examples
# Load a tree
ethical_tree <- load_tree_df(ethical)
# Start interactive mode
if (FALSE) { # \dontrun{
andorR_interactive(ethical_tree)
} # }