MichaelChirico / r-bugs

A ⚠️read-only⚠️mirror of https://bugs.r-project.org/
20 stars 0 forks source link

[BUGZILLA #15696] Potential infinite loop in model.frame.tree #5246

Closed MichaelChirico closed 4 years ago

MichaelChirico commented 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

METADATA

MichaelChirico commented 4 years ago

There is no model.frame.tree in R.

I presume this about package 'tree', not mentioned, and have informed the maintainer.


METADATA