# What causes the big difference between the tree()-function and randomForest()-function in R?

I have a big dataset with more than 100 000 observations and 12 predictors. I used the tree()-function and got the error: Error in plot.tree(tree): cannot plot singlenode tree

But with the exact same data in randomForest() I tried to look at the trees with getTree() and it said that all my trees has roughly 8000 nodes each (!)

Anyone who can explain how this can be?

• It would help if you indicate what package is the tree() function from and if you share the code you used. A short description of the data would also help. For instance, what are the characteristics of the target variable? Is it binary? If so, what is the event rate? As a general suggestion, you could try to see what happens when running the same model fits on other datasets or with less observations on the same dataset to try to pin point the problem. – mastropi May 12 '20 at 13:22