[R] Sorting

David Neu david at davidneu.com
Sat Feb 6 19:21:36 CET 2010


Hi,

I have a list of vectors (of varying lengths).  I'd like to sort this
list by applying a function to each pair of vectors in the list and
returning information to sorting routine that let's it know which one
is larger.

To solve problems like this in Common Lisp, the sort function accepts
a function as an argument.  The arguments to this function are two
elements of the list which is being sorted.  The writer of the
function returns t (TRUE in R) when the first argument to the function
is larger than the second and nil (FALSE in R) otherwise.

I'm wondering if there is some way to accomplish this in R.

Many thanks for any help!

Cheers,
David



More information about the R-help mailing list