Skip to content

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

Closed

Description

@jangorecki

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.

Activity

  1. changed the title [-]data.table join nomatch=quote(stop())[/-] [+][Request] data.table join nomatch=quote(stop())[/+] on Nov 13, 2014
  2. arunsrinivasan commented on Nov 21, 2014

    @arunsrinivasan
    Member

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

  3. jangorecki commented on Dec 13, 2014

    @jangorecki
    MemberAuthor

    merged with #857.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions