I'm working on variable importance plot from random forest regression and want to apply variable labels to y-axis instead of cryptic variable names using the VIP package for ease of interpretation.
How to modify the code to add labels on y axis?
My current code:
library(randomForest)
library(vip)
model1 <- randomForest(y ~ .,
data=train,
mtry = 8,
ntree=500,
import[enter image description here][1]ance=TRUE,
proximity=TRUE)
plot_rf_1 <- vip(model1,
num_features = 6,
include_type = TRUE,
geom = "point",
horizontal = TRUE,
mapping = aes_string(fill="var.labels"),
aesthetics = list(color = "blue", shape = 16, size = 3)) +
theme_light()
grid.arrange(plot_rf_1, nrow = 1)```
Variable importance plot: