marjoleinF / pre

an R package for deriving Prediction Rule Ensembles
58 stars 17 forks source link

Error - "object cannot be coerced to type 'double'" #21

Closed zzfmyway closed 4 years ago

zzfmyway commented 4 years ago

I got the error when trying to use pairplot and singleplot. Other functions in the package works well on my side.

> set.seed(42) > airq.ens <- pre(Ozone ~ ., data = airquality[complete.cases(airquality),]) > pairplot(airq.ens, c("Temp", "Wind")) Error in getvars(var1, p, lx, names) : (list) object cannot be coerced to type 'double'

> singleplot(airq.ens, "Temp") Error in getvars(vars, p, lx, names) : (list) object cannot be coerced to type 'double' In addition: Warning message: In parchk("qntl", qntl, 0, 0.5, 0.025) : invalid value for qntl - default ( 0.025 ) used.

marjoleinF commented 4 years ago

There is no getvars() function called within the singleplot() and pairplot() functions in package pre, so this error probably does not originate from it. My best guess is that you have loaded the original RuleFit (i.e., the rulefit.r file), which contains functions singleplot() and pairplot() as well. Either not loading rulefit.r in the same session, or calling pre::singleplot() and pre::pairplot() could prevent this error from happening. Or you could use the dedicated plotmo package for plotting partial dependencies, which has methods for objects of class pre.

zzfmyway commented 4 years ago

Thanks for quick reply! I did loaded rulefit.r file. Thank you Professor Fokkema!

marjoleinF commented 4 years ago

You are welcome, Little Sun!