[Rd] colnames(tapply(...)) (PR#8539)

Martin Maechler maechler at stat.math.ethz.ch
Mon Jan 30 19:06:27 CET 2006


>>>>> "DavidB" == David Brahm <David.Brahm at geodecapital.com>
>>>>>     on Mon, 30 Jan 2006 18:39:05 +0100 (CET) writes:

    DavidB> Wasn't there once a time when tapply(f,f,sum) (with "f" a vector)
    DavidB> returned a vector instead of a 1D array?  Then colnames(x) would just
    DavidB> give NULL instead of an error.  Sorry my memory isn't more precise.

well, it was very good...

R-0.16  had this 
R-0.63.3 (March 3, 1999)  already didn't anymore, i.e. it
already did return a 1D-array.

So, indeed Karl must have used a *very* old version of R.
Martin Maechler, ETH Zurich

    DavidB> -- David Brahm (brahm at alum.mit.edu)=20


    DavidB> -----Original Message-----
    DavidB> From: r-devel-bounces at r-project.org
    DavidB> [mailto:r-devel-bounces at r-project.org] On Behalf Of Prof Brian Ripley
    DavidB> Sent: Monday, January 30, 2006 3:45 AM
    DavidB> To: karl.thomaseth at isib.cnr.it
    DavidB> Cc: R-bugs at biostat.ku.dk; r-devel at stat.math.ethz.ch
    DavidB> Subject: Re: [Rd] colnames(tapply(...)) (PR#8539)


    DavidB> 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

    DavidB> What is inappropriate about this?  x is a 1D array, so it does not have
    DavidB> column names (or columns).  Indeed, the help page says

    DavidB> x: a matrix-like R object, with at least two dimensions for
    DavidB> 'colnames'.

    DavidB> The exact same message appears in 1.6.2, more than three years old (and=20
    DavidB> the earliest version I still have running). If earlier versions did not=20
    DavidB> have an error message, that was probably a bug.

    DavidB> --=20
    DavidB> Brian D. Ripley,                  ripley at stats.ox.ac.uk
    DavidB> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
    DavidB> University of Oxford,             Tel:  +44 1865 272861 (self)
    DavidB> 1 South Parks Road,                     +44 1865 272866 (PA)
    DavidB> Oxford OX1 3TG, UK                Fax:  +44 1865 272595

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

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



More information about the R-devel mailing list