Rajarshi Guha
2010-Sep-11 21:53 UTC
[R] sorting a (homogenous) list of objects, based on a a field of the objects
Him I have a list of S4 objects. Each object has a field called name, and what I'd like to do is to sort the list based on the value of name. Currently I'm using the following code tmp <- unlist(lapply(fps, function(x) as.integer(x at name))) tmp <- order(tmp, decreasing=FALSE) fps <- fps[ tmp ] this seems a little klunky and I was wondering if there was another way to do this (by analogy with comparator functions in Java) Thanks, -- Rajarshi Guha NIH Chemical Genomics Center