November 2018
Beginner to intermediate
420 pages
10h 4m
English
There are no big differences between growing trees with tree or rpart. Both work in similar ways and both depend on the dtree package, more or less. As the time-cost of growing trees is often too small, I can't see a reason not to try both, hence explaining how to grow trees using both.
The following shows how to recursively grow a decision-tree model using the tree package:
if(!require(tree)){install.packages('tree')}library(tree)tree_tree <- tree(vote ~ . , data = dt_Chile[-i_out,], method = 'class', mindev = 0)
The very first couple of lines are performing a check-install on the tree package and then loading and attaching the whole package. After these two lines, an object called tree_tree is being created. ...
Read now
Unlock full access