cran / model4you

:exclamation: This is a read-only mirror of the CRAN R package repository. model4you — Stratified and Personalised Models Based on Model-Based Trees and Forests
0 stars 0 forks source link

fatal but inconsistent error in gettree() #1

Open RachelHorn opened 4 years ago

RachelHorn commented 4 years ago

When using the gettree() function, sometimes the following occurs:

gettree(My_Forest, 2) Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels

Yet when I run the same line again, it will extract and print the full tree without a problem. The error appears to be random - I used gettree() to extract the same tree 5 times, and the error appeared twice. The error noted above also appears if I try to run the varimp() function, which I assume is happening because it calls upon gettree(). I can try to generate a reprex if needed, but my data is from a clinical trial so I cannot share the existing content. Any help with this issue would be greatly appreciated.

EDIT: I didn't realize gettree() comes from partykit rather than model4you, but github won't let me delete the issue. I imagine you would still like to know this since it is a dependency for your package. Apologies for the error!

gaborcsardi commented 4 years ago

Hi, this is a read only mirror of CRAN, please see the package authors in the DESCRIPTION file. Thanks!