Running examples in ‘iml-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: FeatureEffect
> ### Title: Effect of a feature on predictions
> ### Aliases: FeatureEffect
> 
> ### ** Examples
> 
> # We train a random forest on the Boston dataset:
> if (require("randomForest")) {
+ data("Boston", package  = "MASS")
+ rf = randomForest(medv ~ ., data = Boston, ntree = 50)
+ mod = Predictor$new(rf, data = Boston)
+ 
+ # Compute the accumulated local effects for the first feature
+ eff = FeatureEffect$new(mod, feature = "rm",grid.size = 30)
+ eff$plot()
+ 
+ # Again, but this time with a partial dependence plot and ice curves
+ eff = FeatureEffect$new(mod, feature = "rm", method = "pdp+ice", grid.size = 30)
+ plot(eff)
+ 
+ # Since the result is a ggplot object, you can extend it: 
+ if (require("ggplot2")) {
+  plot(eff) + 
+  # Adds a title
+  ggtitle("Partial dependence") + 
+  # Adds original predictions
+  geom_point(data = Boston, aes(y = mod$predict(Boston)[[1]], x = rm), 
+  color =  "pink", size = 0.5)
+ }
+ 
+ # If you want to do your own thing, just extract the data: 
+ eff.dat = eff$results
+ head(eff.dat)
+ 
+ # You can also use the object to "predict" the marginal values.
+ eff$predict(Boston[1:3,])
+ # Instead of the entire data.frame, you can also use feature values:
+ eff$predict(c(5,6,7))
+ 
+ # You can reuse the pdp object for other features: 
+ eff$set.feature("lstat")
+ plot(eff)
+ 
+ # Only plotting the aggregated partial dependence:  
+ eff = FeatureEffect$new(mod, feature = "crim", method = "pdp")
+ eff$plot() 
+ 
+ # Only plotting the individual conditional expectation:  
+ eff = FeatureEffect$new(mod, feature = "crim", method = "ice")
+ eff$plot() 
+   
+ # Accumulated local effects and partial dependence plots support up to two features: 
+ eff = FeatureEffect$new(mod, feature = c("crim", "lstat"))  
+ plot(eff)
+ 
+ 
+ # FeatureEffect plots also works with multiclass classification
+ rf = randomForest(Species ~ ., data = iris, ntree=50)
+ mod = Predictor$new(rf, data = iris, type = "prob")
+ 
+ # For some models we have to specify additional arguments for the predict function
+ plot(FeatureEffect$new(mod, feature = "Petal.Width"))
+ 
+ # FeatureEffect plots support up to two features: 
+ eff = FeatureEffect$new(mod, feature = c("Sepal.Length", "Petal.Length"))
+ eff$plot()   
+ 
+ # show where the actual data lies
+ eff$plot(show.data = TRUE)   
+ 
+ # For multiclass classification models, you can choose to only show one class:
+ mod = Predictor$new(rf, data = iris, type = "prob", class = 1)
+ plot(FeatureEffect$new(mod, feature = "Sepal.Length"))
+ }
Loading required package: randomForest
randomForest 4.6-14
Type rfNews() to see new features/changes/bug fixes.
Loading required package: ggplot2

Attaching package: ‘ggplot2’

The following object is masked from ‘package:randomForest’:

    margin

Error in grid.Call.graphics(C_setviewport, vp, TRUE) : 
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
Calls: <Anonymous> ... lapply -> FUN -> push.vp.viewport -> grid.Call.graphics
Execution halted