Closed agrueneberg closed 9 years ago
I'll probably have to look in the R source code how dispatching of single indexes is done. Testing for missing(j)
does not tell me whether it's [i]
or [i,]
.
Found a (fairly obvious) solution: nargs
will be 2 if only i
is passed, and 3 if both i
and j
are passed.
That is right. I am not sure what they do. what about setting NULL as default for both i and j and then checking is.null() instead of is.missing()?
On Wed, Jun 10, 2015 at 10:48 AM, Alexander Grüneberg < notifications@github.com> wrote:
I'll probably have to look in the R source code how dispatching of single indexes is done. Testing for missing(j) does not tell me whether it's [i] or [i,].
— Reply to this email directly or view it on GitHub https://github.com/QuantGen/BEDMatrix/issues/7#issuecomment-110781448.
You're right, @gdlc, I just tried it and checking is.null()
would have worked, too. [
is a primitive method, and it seems like their dispatch is a lot more relaxed than say S4. I wanted to keep a simple signature, so missing()
and nargs()
are working pretty well.
Example:
bed[1]