Re: [Bioc-devel] a S4 dispatching question

2014-08-06 Thread Gabe Becker
Mike, This makes sense (I was actually surprised I was able to get my example to work as easily as I did). The thing is, if you are dispatching on i (which you must if any methods do), you HAVE to know what class i is in order to identify the method. AFAIK there is no way in R of doing that witho

Re: [Bioc-devel] a S4 dispatching question

2014-08-06 Thread Mike
Gebe, Your suggestion only works in an environment where no formal argument 'i' is defined in any of existing '[' method. e..g > showMethods("[") Function: [ (package base) x="nonStructure" Once we load the package that exports '[' methods with 'i' (e.g. 'flowCore' ), then method dispatch st

Re: [Bioc-devel] a S4 dispatching question

2014-08-06 Thread Greg Finak
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 be

Re: [Bioc-devel] a S4 dispatching question

2014-08-06 Thread Gabe Becker
Mike, This can be done. I would argue that the convenience your users get from this is far outweighed by the damage this does to the ability to read and easily understand the code they are writing. Users, maintainers, etc now need to know the object class, what columns it has and what variables ar

[Bioc-devel] a S4 dispatching question

2014-08-06 Thread Mike
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