Thanks!
This is so weird. I can't get a stripped version of it to work. The stripped code (using a different data set) comes down to this:
But it gives an error:
The problem I had before.
Basically, what I want to do: apply the partialPlot function to a list of variable names to get a selection of plots. However, partialPlot only works when I type out the names of the variables. Does that make sense?
This is so weird. I can't get a stripped version of it to work. The stripped code (using a different data set) comes down to this:
Code:
library(randomForest)
dataset <- mtcars
model <- randomForest(mpg ~ ., data=dataset)
plotMargins <- function(fac) partialPlot(model, dataset, eval(fac))
lapply(c("disp", "wt", "gear"), plotMargins)
Code:
"Error in `[.data.frame`(pred.data, , xname) : undefined columns selected"
Basically, what I want to do: apply the partialPlot function to a list of variable names to get a selection of plots. However, partialPlot only works when I type out the names of the variables. Does that make sense?
Last edited: