[R] Consistent behaviour of for-loop

Greg Snow Greg.Snow at imail.org
Fri Apr 16 01:22:21 CEST 2010


The first thing to do is look at the help page for the function: ?qqnorm and ?qqmath, the package where these functions are defined is at the top of the page, if that package is graphics then it is a base graphics function, if the package is grid, lattice, or ggplot2 then it is grid based graphics.  If you are using a function from another package than listed already, then you will need to do a bit more research.

Is your goal really to produce a whole set of normal qq plots from random data?  If so, you may be interested in the vis.test function in the TeachingDemos package (and associated functions).  One way to run this will mix together a qqplot of your data along with data generated from a normal distribution with the same mean and var so you can visually compare the plot of your data to plots of normal (and then lets you try to choose which is the real data).

If this was just an example, then ignore the above paragraph.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Uwe Dippel
> Sent: Thursday, April 15, 2010 5:01 AM
> To: Peter Ehlers
> Cc: r-help at r-project.org
> Subject: Re: [R] Consistent behaviour of for-loop
> 
> Peter Ehlers wrote:
> > You are mixing 'traditional' graphics (par(...)) and
> > 'lattice' graphics.
> > That won't work. In lattice, you use the 'layout' argument to
> > select the number of columns/rows. This is easiest if you set
> > up a conditioning variable:
> >
> >   cond <- gl(12, 20, labels = letters[1:12])
> >   x <- rnorm(12*20)
> >   qqmath(~x | cond, layout = c(4, 3))
> >
> > Note that layout = c(columns, rows), not c(rows, columns).
> >
> > Since you're new to R, let me also recommend very strongly
> > that you learn to use the str() function (not needed for
> > this problem, but undoubtedly indispensible in your further
> > adventures in R-land).
> >
> Nice example, and good recommendation!
> 
> (It is difficult to satisfy me:)
> How can one know/see, what is traditional graphics, and what is lattice
> graphics? Or is it try-and-fail-and-use-the-alternative?
> 
> Thanks,
> 
> Uwe
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list