[Rd] dim "heritage"

Prof Brian D Ripley ripley@stats.ox.ac.uk
Sun, 1 Apr 2001 19:50:11 +0100 (BST)


On Sun, 1 Apr 2001, Erich Neuwirth wrote:

> i understand that part.
> i wonder if it would make sense
> thnat sort(x) also keeps the dimensions
> (it should be an object of the same dimensions in any case i can
> imagine).

Not so: it sorts as a vector, ignoring the multidimensional stucture.
Also, consider na.last = NA?

In any case, sort is not group Math and so not implemented by a group
generic function.  One needs to know about such things to predict
the fine details like this.

>
>
> Prof Brian Ripley wrote:
> >
> > On Sun, 1 Apr 2001, Erich Neuwirth wrote:
> >
> > > when i do
> > >
> > > x<-4:1
> > > dim(x)<-c(4,1)
> > >
> > > and then
> > > z<-sin(x)
> > > dim(z) is c(4,1)
> > >
> > > sort(x)
> > > however, does not have a dim attribute.
> > >
> > > is this intended behavior?
> >
> > Yes.  You would expect x^2 to act elementwise, and all elementwise
> > arithmetic operations keep the dimensions.
> >
> > --
> > Brian D. Ripley,                  ripley@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 272860 (secr)
> > Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
> --
> Erich Neuwirth, Computer Supported Didactics Working Group
> Visit our SunSITE at http://sunsite.univie.ac.at
> Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
>

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._