Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support single indexes #7

Closed
agrueneberg opened this issue Jun 10, 2015 · 4 comments
Closed

Support single indexes #7

agrueneberg opened this issue Jun 10, 2015 · 4 comments

Comments

@agrueneberg
Copy link
Member

Example: bed[1]

@agrueneberg
Copy link
Member Author

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,].

@agrueneberg
Copy link
Member Author

Found a (fairly obvious) solution: nargs will be 2 if only i is passed, and 3 if both i and j are passed.

@gdlc
Copy link

gdlc commented Jun 12, 2015

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
#7 (comment).

@agrueneberg
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants