I am using Random Forest, and now I need to plot the importance plot. I achieved that by implementing the code:
data <- read.table("sample.matrix", header = T, sep = ",", check.names=FALSE)
x_num <- data[6:ncol(data)]
x_feature <- data$Feature
resul_rf <- randomForest(x_num, x_feature ,importance=TRUE, proximity=TRUE, ntree=500)
varImpPlot(resul_rf , type=1, pch=19, col="black", cex=.8)
This code above will plot graph importance from random Forest analysis. But how can I save this image in disk programmatically like in ggplot where we specify:
ggsave(file="namefile.jpg", width=500, height=700)
I've searched about it but unfortunately, I did not find anything. Can someone help me out with that?. I need to save the plot as jpg and pdf file.