[Rd] colnames(tapply(...)) (PR#8539)
David.Brahm@geodecapital.com
David.Brahm at geodecapital.com
Mon Jan 30 18:39:05 CET 2006
Wasn't there once a time when tapply(f,f,sum) (with "f" a vector)
returned a vector instead of a 1D array? Then colnames(x) would just
give NULL instead of an error. Sorry my memory isn't more precise.
-- David Brahm (brahm at alum.mit.edu)=20
-----Original Message-----
From: r-devel-bounces at r-project.org
[mailto:r-devel-bounces at r-project.org] On Behalf Of Prof Brian Ripley
Sent: Monday, January 30, 2006 3:45 AM
To: karl.thomaseth at isib.cnr.it
Cc: R-bugs at biostat.ku.dk; r-devel at stat.math.ethz.ch
Subject: Re: [Rd] colnames(tapply(...)) (PR#8539)
On Mon, 30 Jan 2006 karl.thomaseth at isib.cnr.it wrote:
> I would like to bring to your attention the following error message
> which didn't appear on previous versions (long time ago?)
>
> Thanks for all your effort
>
> Karl
>
> Version 2.2.1 Patched (2006-01-21 r37153)
>
> > f <- rep(c(1,2),each=3D5)
> > x <- tapply(f,f,sum)
> > colnames(x)
> Error in dn[[2]] : subscript out of bounds
What is inappropriate about this? x is a 1D array, so it does not have
column names (or columns). Indeed, the help page says
x: a matrix-like R object, with at least two dimensions for
'colnames'.
The exact same message appears in 1.6.2, more than three years old (and=20
the earliest version I still have running). If earlier versions did not=20
have an error message, that was probably a bug.
--=20
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
______________________________________________
R-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list