[Rd] order function called on a data.frame?

Michael Lawrence
Mon, 18 May 2020 15:51:45 -0000

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 at 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 at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
>
> ______________________________________________
> R-devel at 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 at gene.com

Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube