colnames(tapply(...)) (PR#8539)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

colnames(tapply(...)) (PR#8539)

Karl Thomaseth
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=5)
 > x <- tapply(f,f,sum)
 > colnames(x)
Error in dn[[2]] : subscript out of bounds


-------------------------------
Karl Thomaseth, Ph.D.
Research Director
National Research Council
Institute of Biomedical Engineering ISIB-CNR
Corso Stati Uniti 4
35127 Padova, ITALY
http://www.isib.cnr.it/~karl/
tel.: (+39) 049 8295762,  fax:  (+39) 049 8295763


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: colnames(tapply(...)) (PR#8539)

Brian Ripley
On Mon, 30 Jan 2006 [hidden email] 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=5)
> > 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
the earliest version I still have running). If earlier versions did not
have an error message, that was probably a bug.

--
Brian D. Ripley,                  [hidden email]
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: colnames(tapply(...)) (PR#8539)

Brahm, David
In reply to this post by Karl Thomaseth
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 ([hidden email])=20


-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Prof Brian Ripley
Sent: Monday, January 30, 2006 3:45 AM
To: [hidden email]
Cc: [hidden email]; [hidden email]
Subject: Re: [Rd] colnames(tapply(...)) (PR#8539)


On Mon, 30 Jan 2006 [hidden email] 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,                  [hidden email]
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: colnames(tapply(...)) (PR#8539)

Martin Maechler
>>>>> "DavidB" == David Brahm <[hidden email]>
>>>>>     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 ([hidden email])=20


    DavidB> -----Original Message-----
    DavidB> From: [hidden email]
    DavidB> [mailto:[hidden email]] On Behalf Of Prof Brian Ripley
    DavidB> Sent: Monday, January 30, 2006 3:45 AM
    DavidB> To: [hidden email]
    DavidB> Cc: [hidden email]; [hidden email]
    DavidB> Subject: Re: [Rd] colnames(tapply(...)) (PR#8539)


    DavidB> On Mon, 30 Jan 2006 [hidden email] 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,                  [hidden email]
    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> [hidden email] mailing list
    DavidB> https://stat.ethz.ch/mailman/listinfo/r-devel

    DavidB> ______________________________________________
    DavidB> [hidden email] mailing list
    DavidB> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel