Re: [R] using hist() with tapply()

From: Kjetil Brinchmann Halvorsen <kjetil_at_acelerate.com>
Date: Thu 02 Sep 2004 - 07:58:59 EST

Schwarz,Paul wrote:

>Hi,
>
>I've been passing the hist() function to tapply() to quickly generate histograms based on the list of factors supplied to tapply(). However, I have not figured out how to generate titles for each of the histograms, which paste in the unique values of the list factors as part of the histogram title. I'm hoping that someone can tell me how to do this.
>
>Thanks for your time and consideration,
>
>-Paul Schwarz
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
>
>
I can't see it with talpply, but mapply and split works:

test <- rnorm(1000)
fac <- factor( rep(1:5, 200))
par(mfrow=c(2,3))
mapply(hist, split(test, fac), main=levels(fac))

-- 

Kjetil Halvorsen.

Peace is the most effective weapon of mass construction.
               --  Mahdi Elmandjra

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Sep 02 13:38:17 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:56:25 EST