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

[Request] data.table join nomatch=quote(stop()) #940

Closed
jangorecki opened this issue Nov 10, 2014 · 2 comments
Closed

[Request] data.table join nomatch=quote(stop()) #940

jangorecki opened this issue Nov 10, 2014 · 2 comments

Comments

@jangorecki
Copy link
Member

Feature Request.
Related to #857.

We have 2 dts:

library(data.table)
dict <- data.table(symbol = c("a","b","c"), ratio = c(5,10,15), key = "symbol")
dt <- data.table(symbol = c("a","b","c","d"), value = rnorm(4))

Which we want join:

dict[dt][,list(symbol, new_value = ratio * value)]

Consider the case when we expect to have match on all data in the join.
In case of nomatch we want to raise error.
Currently it is possible using:

new_dt <- dict[dt]
if(any(is.na(new_dt$ratio))) stop("missing data in the reference dictionary")

Which makes us unable to make chaining in such case.
If we could use something like this:

dict[dt,nomatch=quote(stop("missing data in the reference dictionary"))
     ][,list(symbol, new_value = ratio * value)]

just to stop process and raise the error in case of any nomatch.

@jangorecki jangorecki changed the title data.table join nomatch=quote(stop()) [Request] data.table join nomatch=quote(stop()) Nov 13, 2014
@arunsrinivasan
Copy link
Member

Or nomatch = "error" like #655. I'd say this should be added to #857, and closed, as this is very related to #857.

@jangorecki
Copy link
Member Author

merged with #857.

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

No branches or pull requests

2 participants