function that extract the sequence of nested trees

extract_subtrees(tree, cp)

Arguments

tree

a tree. A data frame returned by the function CARTGV and which summarizes the resulted CARTGV tree.

cp

a data frame that summarizes the complexity as explained in the example in Breiman (chap 10, 1984). It is the object cp returned by the function cost_complexity.

Value

a list containing the sequence of optimal subtrees.