[Rd] tapply/barplot (PR#6983)

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jun 15 14:31:59 CEST 2004


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 at 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 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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list