From ripley at stats.ox.ac.uk  Tue Jun 15 14:31:59 2004
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue Jun 15 14:32:07 2004
Subject: [Rd] tapply/barplot (PR#6983)
In-Reply-To: <20040615122005.D794C105A2@slim.kubism.ku.dk>
Message-ID: <Pine.LNX.4.44.0406151324050.5383-100000@gannet.stats>

But not in R 1.9.1 beta, due for release next Monday.  This has been
reported quite a few times already -- see the R-help archives and
PR#6676/7/8 and PR#6894, for example.

Note that the plots in 1.9.1 beta are deliberately different from 1.7.0.

On Tue, 15 Jun 2004 Vidar.Hjellvik@imr.no wrote:

> Hello,
> 
> there seems to be a bug in tapply or barplot in R 1.9.0 that was not in =
> earlier versions. 

It's not a bug, rather a design change.  That change has been revisited in 
1.9.1.

> The following code creates two nice barplots in 1.7.0, =
> but the first one is bad in 1.9.0:
> 
> par(mfrow=c(1,2))
> x <- rep(1:10,10)
> y <- runif(100,1,100)
> z <- tapply(y,x,mean)
> barplot(z)
> barplot(as.numeric(z))
> 
> although is.numeric(z) returns TRUE!

Yes, but z is a 1D array, and as.numeric makes it into a numeric *vector*.

-- 
Brian D. Ripley,                  ripley@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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


[Rd] tapply/barplot (PR#6983)
Prof Brian Ripley