Skip to content

order() function, decreasing=TRUE unexpected behaviour

3 messages · Hawthorne Beyer, Jeff Newmiller

#
I think you are confused, and there is no problem with the order function. Keep in mind that order returns the index values in a sequence such that when the result of the order function is used as indexes for the original sequence then the data will be sorted as desired. You may see the error of your ways more clearly if you use a vector of strings like c("b","a","c","d","e") instead of integer values.

Please configure your email client to send plain text to this list as the Posting Guide requests, as HTML messes up R code.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
Hawthorne Beyer <h.beyer at uq.edu.au> wrote:
#
Thank you Jeff. You are correct. I am relieved it is my mistake. Apologies for bothering everyone. I will try harder next time!
Best wishes,
Hawthorne Beyer
University of Queensland