How can I reset the graph to draw something new at the end of the loop?
For example,
I need to plot a graph. Then save the graph in a file, called "graph1.pdf"
Then loop this 3 times, saving files "graph2.pdf", "graph3.pdf"
If I put dev.off() at the end of the loop, R gave me the error message that
could not find function "device
I figured maybe it was because I shut down the PDF device.
So, maybe I should use dev.set() or dev.new() instead?
Thanks for any help!