Plotting an array of histograms
On Sat, 28 Jul 2001 Ted.Harding at nessie.mcc.ac.uk wrote:
On 27-Jul-01 Liaw, Andy wrote:
Assuming x.df is the data frame with two columns, x (the value) and group (indicator for groups). Try something like par(mfrow=c(5,5)) # ask for 5x5 array of plots, by row tapply(x.df$x, x.df$group, hist) Andy
Thanks to Andy for this suggestion, which basically works in that it generates the requisite array of histograms. And I'm also grateful for being thereby forced to look more closely into this aspect of R programming, which was useful and instructive! However, using Andy's method I'm still having trouble getting the histograms labelled etc as I would like, which is why I'm also interested in Thomas Lumley's suggestion:
Use the histogram function in the new 'lattice' package
-thomas
for which also thanks. However, where is it? It doesn't seem to be part of R-1.3 which I have just downloaded, and I can't seem to find any mention of "lattice" on CRAN.
Yes, I thought maybe Thomas needed to say where. You need the packages grid and lattice from the Devel section on CRAN, and you had better be using 1.3.0 (which is what I assume you mean by R-1-3). Both grid and lattice are under development, which is why they are in Devel. You may need a description of S's Trellis to get an overview of what lattice is intended to do, but don't expect perfect equivalence (especially not yet).
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._