Mike, what about overriding the %in% operator for Gating sets. It keeps
things simple and preserves the existing bracket operator semantics.
Greg
I'd like to do 'data.table-like' subsetting on `S4 class` by using 'i
expression'. However, '[' generic function has the problem to dispatch S4
method because of its early evaluation of i argument.
e.g.

> gslist[Visit == 1, ]
Error in gslist[Visit == 1, ] :
  error in evaluating the argument 'i' in selecting a method for function
'[': Error: object 'Visit' not found

Here 'gslist' is a S4 object `GatingSet` .

I wasn't able to bypass this even after I defined my own S3 method (e.g
[.GatingSet).
I guess it is because 'GatingSet' is S4 class and there are already some S4
methods defined by other packages

> showMethods("[")
Function: [ (package base)
x="AnnotatedDataFrame", i="ANY"
x="flowFrame", i="ANY"
...

So it will always try these S4 methods before any S3 gets its chance.

Is there better way other than these two?
1. change 'GatingSet' to S3 class
2. use a different generic function that is not associated with any S4
methods (e.g. subset)

Mike

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

	[[alternative HTML version deleted]]

