[R] inclusion criteria help

Aaron J Mackey ajm6q at virginia.edu
Tue Nov 27 18:02:16 CET 2001

On Tue, 27 Nov 2001, Thomas Lumley wrote:

> so for many queries you could tapply() or by() this process
>   filter<-function(this.subset){
> 	this.subset[this.subset$coverage==max(this.subset$coverage),]
> 	}
>   filtered<-by(hits, hits$query,filter)

Thank you, this was the bit of R programming style that I hadn't yet
learned.  A small followup question regarding the "selection" filter: what
if there are ties in (maximal) coverage that need to be broken by
additional logic ?

so that:

filter <- function(subset) { subset[which.max(subset$coverage),] }


sort.func <- function(subsect) {
  # sort by max(coverage), break ties with additional logic ??
filter <- function(subset) { subset[sort.func(subset),] }

Thanks again,


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list