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 ([EMAIL PROTECTED])=20


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Prof Brian Ripley
Sent: Monday, January 30, 2006 3:45 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; r-devel@stat.math.ethz.ch
Subject: Re: [Rd] colnames(tapply(...)) (PR#8539)


On Mon, 30 Jan 2006 [EMAIL PROTECTED] 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,                  [EMAIL PROTECTED]
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to