I think that you want: if (i %% 4 == 1 ) { dev.new() par(mfrow=c(2,2)) }
or with the R 3.0.2 it looks like you will be able to do: if( par('page') ) { dev.new() par(mfrow=c(2,2)) } On Thu, Sep 26, 2013 at 10:47 AM, Hui Du <hui...@dataventures.com> wrote: > > Hi All, > > I have a question about plotting graphs. Supposedly, I want to plot 12 > graphs. Putting 12 graphs to one window seems too crowded. Ideally, I want > to put 4 pictures in one window and plot them in three separate window. For > exmaple, my psuedo code is like > > > par(mfrow = c(2, 2)) > > for( I in 1:12) > { > plot(rnorm(100)); > > if( i %% 4 == 0) > # > # open a New window with par(mfrow = c(2, 2)): > # My question is how to control here? Thank you for your help. > # > } > > HXD > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.