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

chmatch validate nomatch argument #1672

Closed
jangorecki opened this issue Apr 25, 2016 · 1 comment
Closed

chmatch validate nomatch argument #1672

jangorecki opened this issue Apr 25, 2016 · 1 comment
Assignees
Labels
Milestone

Comments

@jangorecki
Copy link
Member

jangorecki commented Apr 25, 2016

Docs states that nomatch is coerced to integer.
When providing integer of length 0L it should warn/error/handle other way. Currently output is not really useful.

library(data.table)
chmatch(c("a","b"), c("a","c"), nomatch = integer())
#[1]        1 45133224
@jangorecki jangorecki added the Low label Apr 25, 2016
@MichaelChirico
Copy link
Member

MichaelChirico commented Apr 25, 2016

base::match returns NA (no warning):

match(c("a","b"), c("a","c"), nomatch = integer())
# [1]  1 NA

Looks like it's just wrapping in asInteger in C:

...
int nomatch = asInteger(CADDR(args));
...

@arunsrinivasan arunsrinivasan added this to the v1.9.8 milestone Apr 25, 2016
@arunsrinivasan arunsrinivasan self-assigned this Apr 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants