Re: [R] inclusion criteria help

About this list Date view Thread view Subject view Author view Attachment view

From: Aaron J Mackey (ajm6q@virginia.edu)
Date: Wed 28 Nov 2001 - 04:02:16 EST


Message-id: <Pine.OSF.4.33.0111271147490.4432-100000@alpha10.bioch.virginia.edu>


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),] }

becomes:

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

Thanks again,

-Aaron

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Thu 17 Jan 2002 - 11:10:09 EST