[Rd] order function called on a data.frame?
Jan Gorecki
j@goreck| @end|ng |rom w|t@edu@p|
Sun May 31 14:52:05 CEST 2020
So maybe for now just warning/error?
Should be much smaller change then those proposed by William and Michael.
Rui,
Your example of order list does raise error, but if you remove second
argument, it won't raise error anymore.
On Mon, May 18, 2020 at 5:27 PM William Dunlap via R-devel
<r-devel using r-project.org> wrote:
>
> do.call(order, df). -> do.call(order, unname(df)).
>
> While you are looking at order(), it would be nice if ';decreasing' could
> be a vector the the length of list(...) so you could ask to sort some
> columns in increasing order and some decreasing. I thought I put this on
> bugzilla eons ago, but perhaps not.
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
>
> On Mon, May 18, 2020 at 8:52 AM Michael Lawrence via R-devel <
> r-devel using r-project.org> wrote:
>
> > I guess we could make it do the equivalent of do.call(order, df).
> >
> > On Mon, May 18, 2020 at 8:32 AM Rui Barradas <ruipbarradas using sapo.pt> wrote:
> > >
> > > Hello,
> > >
> > > There is a result with lists? I am getting
> > >
> > >
> > > order(list(letters, 1:26))
> > > #Error in order(list(letters, 1:26)) :
> > > # unimplemented type 'list' in 'orderVector1'
> > >
> > > order(data.frame(letters, 1:26))
> > > # [1] 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
> > > #[22] 48 49 50 51 52 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
> > > #[43] 17 18 19 20 21 22 23 24 25 26
> > >
> > >
> > > And I agree that order with data.frames should give a warning. The
> > > result is indeed useless:
> > >
> > > data.frame(letters, 1:26)[order(data.frame(letters, 1:26)), ]
> > >
> > >
> > > Hope this helps,
> > >
> > > Rui Barradas
> > >
> > >
> > > Às 00:19 de 18/05/20, Jan Gorecki escreveu:
> > > > Hi,
> > > > base::order main input arguments are defined as:
> > > >
> > > > a sequence of numeric, complex, character or logical vectors, all of
> > > > the same length, or a classed R object
> > > >
> > > > When passing a list or a data.frame, the resuts seems to be a bit
> > > > useless. Shouldn't that raise an error, or at least warning?
> > > >
> > > > Best Regards,
> > > > Jan Gorecki
> > > >
> > > > ______________________________________________
> > > > R-devel using r-project.org mailing list
> > > > https://stat.ethz.ch/mailman/listinfo/r-devel
> > > >
> > >
> > > ______________________________________________
> > > R-devel using r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
> >
> >
> > --
> > Michael Lawrence
> > Senior Scientist, Data Science and Statistical Computing
> > Genentech, A Member of the Roche Group
> > Office +1 (650) 225-7760
> > michafla using gene.com
> >
> > Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube
> >
> > ______________________________________________
> > R-devel using r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list