R assigning ggplot objects to list in loop
The answers so far are very close, but unsatisfactory in my opinion. The problem is the following – after your for loop: myplots[[1]]$mapping #* x -> 1:dfmsize #* y -> dfrm[, i] myplots[[1]]$plot_env #<environment: R_GlobalEnv> myplots[[2]]$mapping #* x -> 1:dfmsize #* y -> dfrm[, i] myplots[[2]]$plot_env #<environment: R_GlobalEnv> i #[1] “B” As the other answers … Read more