I use the simple ggplot function, which works great outside the loop, but not inside, even if the iterative value does not interfere with the ggplot function. Why is this so?
Here is my code
x=1:7 y=1:7 df = data.frame(x=x,y=y) ggplot(df,aes(x,y))+geom_point()
It works! But if ggplot is inside the for ... loop
for (i in 1:5) { ggplot(df,aes(x,y))+geom_point() }
it no longer works, what am I missing?
for-loop r ggplot2
Remi.b Mar 28 '13 at 9:29 2013-03-28 09:29
source share