I am trying after the following code to find a way to save as a pdf the image output that appears after the fancyRpartPlot to plot the regression tree. Anybody knows how can I do that? I couldn't find any answer through the web.
regression_tree <- data.frame(stock_mag = as.numeric(resData$stock_mag),
LT = as.numeric(resData$Lead_Time),
dmIn = as.numeric(resData$Intermittency),
dmCv = as.numeric(resData$CoV))
fit<-rpart(stock_mag~dmCv+dmIn+LT,data=regression_tree, method="anova", control=rpart.control(minsplit=20))
x11()
fancyRpartPlot(fit, main="test") # Will plot the tree#
Thanks!!