Closed MichaelChirico closed 4 years ago
The model.frame method for tree objects includes this line:
while (deparse(oc[[1L]]) != "tree") oc <- eval(oc[[2L]])$call
if the tree object was constructed with a call including the package name (i.e.: tree::tree(...)), the above loop will never end.
Example:
First, successful example using plain "tree"
library(tree) library(ISLR) attach(Carseats) High=ifelse(Sales<=8, "no", "Yes") Carseats=data.frame(Carseats, High) tree.carseats = tree(High~.-Sales, Carseats) head(model.frame(tree.carseats))
Now, problem using "tree::tree"
bad.carseats = tree::tree(High~.-Sales, Carseats) head(model.frame(bad.carseats)) #does not return
There is no model.frame.tree in R.
I presume this about package 'tree', not mentioned, and have informed the maintainer.
The model.frame method for tree objects includes this line:
while (deparse(oc[[1L]]) != "tree") oc <- eval(oc[[2L]])$call
if the tree object was constructed with a call including the package name (i.e.: tree::tree(...)), the above loop will never end.
Example:
First, successful example using plain "tree"
Now, problem using "tree::tree"
METADATA