Graphs are printed the same I have tried many ways but all my plots printed out the same. When I tried using the for-loop and ggplot (without marrangeGrob), the graphs are different but they are printed out separate, while I want it to print out 4 graphs on each page. Does anyone know how to do it? Here is the written code:
char_var <- select_if(train,is.character)
#names(char_var)
library(gridExtra)
plot_char <- list()
for (i in 1:43 ) {
plot_char[[length(plot_char)+1]]= ggplot(data=train,mapping= aes(x= char_var[,i], y = SalePrice)) + xlab(i)+ geom_boxplot()
}
marrangeGrob(grobs = plot_char, nrow = 2, ncol=2)