Currently, results from the pdp package has class like c("data.frame", "partial").
This is not robust to the conflict of S3 methods because a method for data.frame has priority to methods for pdp specific classes.
For example, if I define autoplot.data.frame, it is used instead of autoplot.partial by partial(plot = TRUE, plot.engine = "ggplot2").
This PR fixes the problem by prioritizing pdp specific classes over data.frame (e.g., c("partial", "data.frame"))
library(pdp)
library(randomForest)
#> randomForest 4.6-14
#> Type rfNews() to see new features/changes/bug fixes.
data (boston) # load the boston housing data
set.seed(101) # for reproducibility
boston.rf <- randomForest(cmedv ~ ., data = boston)
partial(boston.rf, pred.var = "lstat", plot = TRUE, plot.engine = "ggplot2", rug = TRUE)
Currently, results from the pdp package has class like
c("data.frame", "partial")
. This is not robust to the conflict of S3 methods because a method for data.frame has priority to methods for pdp specific classes. For example, if I defineautoplot.data.frame
, it is used instead ofautoplot.partial
bypartial(plot = TRUE, plot.engine = "ggplot2")
. This PR fixes the problem by prioritizing pdp specific classes over data.frame (e.g.,c("partial", "data.frame")
)Created on 2019-11-04 by the reprex package (v0.3.0)