{"action":"created","issue":{"url":"https://api.github.com/repos/Rdatatable/data.table/issues/1130","labels_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1130/labels{/name}","comments_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1130/comments","events_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1130/events","html_url":"https://github.com/Rdatatable/data.table/issues/1130","id":71603833,"number":1130,"title":"Implement joins using secondary keys","user":{"login":"arunsrinivasan","id":3102045,"avatar_url":"https://avatars.githubusercontent.com/u/3102045?v=3","gravatar_id":"","url":"https://api.github.com/users/arunsrinivasan","html_url":"https://github.com/arunsrinivasan","followers_url":"https://api.github.com/users/arunsrinivasan/followers","following_url":"https://api.github.com/users/arunsrinivasan/following{/other_user}","gists_url":"https://api.github.com/users/arunsrinivasan/gists{/gist_id}","starred_url":"https://api.github.com/users/arunsrinivasan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunsrinivasan/subscriptions","organizations_url":"https://api.github.com/users/arunsrinivasan/orgs","repos_url":"https://api.github.com/users/arunsrinivasan/repos","events_url":"https://api.github.com/users/arunsrinivasan/events{/privacy}","received_events_url":"https://api.github.com/users/arunsrinivasan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Rdatatable/data.table/labels/feature%20request","name":"feature request","color":"734A82"},{"url":"https://api.github.com/repos/Rdatatable/data.table/labels/High","name":"High","color":"A62A7C"}],"state":"closed","locked":false,"assignee":{"login":"arunsrinivasan","id":3102045,"avatar_url":"https://avatars.githubusercontent.com/u/3102045?v=3","gravatar_id":"","url":"https://api.github.com/users/arunsrinivasan","html_url":"https://github.com/arunsrinivasan","followers_url":"https://api.github.com/users/arunsrinivasan/followers","following_url":"https://api.github.com/users/arunsrinivasan/following{/other_user}","gists_url":"https://api.github.com/users/arunsrinivasan/gists{/gist_id}","starred_url":"https://api.github.com/users/arunsrinivasan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunsrinivasan/subscriptions","organizations_url":"https://api.github.com/users/arunsrinivasan/orgs","repos_url":"https://api.github.com/users/arunsrinivasan/repos","events_url":"https://api.github.com/users/arunsrinivasan/events{/privacy}","received_events_url":"https://api.github.com/users/arunsrinivasan/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Rdatatable/data.table/milestones/2","html_url":"https://github.com/Rdatatable/data.table/milestones/v1.9.6","labels_url":"https://api.github.com/repos/Rdatatable/data.table/milestones/2/labels","id":780666,"number":2,"title":"v1.9.6","description":"Next release","creator":{"login":"arunsrinivasan","id":3102045,"avatar_url":"https://avatars.githubusercontent.com/u/3102045?v=3","gravatar_id":"","url":"https://api.github.com/users/arunsrinivasan","html_url":"https://github.com/arunsrinivasan","followers_url":"https://api.github.com/users/arunsrinivasan/followers","following_url":"https://api.github.com/users/arunsrinivasan/following{/other_user}","gists_url":"https://api.github.com/users/arunsrinivasan/gists{/gist_id}","starred_url":"https://api.github.com/users/arunsrinivasan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunsrinivasan/subscriptions","organizations_url":"https://api.github.com/users/arunsrinivasan/orgs","repos_url":"https://api.github.com/users/arunsrinivasan/repos","events_url":"https://api.github.com/users/arunsrinivasan/events{/privacy}","received_events_url":"https://api.github.com/users/arunsrinivasan/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":150,"state":"open","created_at":"2014-09-06T12:24:59Z","updated_at":"2015-08-12T02:57:20Z","due_on":null,"closed_at":null},"comments":10,"created_at":"2015-04-28T14:23:19Z","updated_at":"2015-08-18T15:13:43Z","closed_at":"2015-08-10T08:05:29Z","body":"- [x] `X[Y]` gains an `on = ` argument (as proposed by Matt).\r\n- [x] `merge` will not copy anymore once implemented.\r\n\r\nUpdate posts:\r\n- [ ] Update [this](http://stackoverflow.com/q/29918595/559784) SO post as well.\r\n- [x] And [this](http://stackoverflow.com/q/27612859/559784)"},"comment":{"url":"https://api.github.com/repos/Rdatatable/data.table/issues/comments/132245396","html_url":"https://github.com/Rdatatable/data.table/issues/1130#issuecomment-132245396","issue_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1130","id":132245396,"user":{"login":"jan-glx","id":1266815,"avatar_url":"https://avatars.githubusercontent.com/u/1266815?v=3","gravatar_id":"","url":"https://api.github.com/users/jan-glx","html_url":"https://github.com/jan-glx","followers_url":"https://api.github.com/users/jan-glx/followers","following_url":"https://api.github.com/users/jan-glx/following{/other_user}","gists_url":"https://api.github.com/users/jan-glx/gists{/gist_id}","starred_url":"https://api.github.com/users/jan-glx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jan-glx/subscriptions","organizations_url":"https://api.github.com/users/jan-glx/orgs","repos_url":"https://api.github.com/users/jan-glx/repos","events_url":"https://api.github.com/users/jan-glx/events{/privacy}","received_events_url":"https://api.github.com/users/jan-glx/received_events","type":"User","site_admin":false},"created_at":"2015-08-18T15:13:43Z","updated_at":"2015-08-18T15:13:43Z","body":"Nice work, @arunsrinivasan !\r\nRelated and \"created\" error messages might want some tuning so that this awesome stuff gets used:\r\n````\r\ndt1=data.table(x=1:3,y=as.character(2:4),z=1:3);dt2=data.table(x=1:3,y=as.character(2:4),z=3:5)\r\n> dt1[dt2]  # bla..bla.. we know we are just to lazy to write setkey twice every three lines\r\nError in `[.data.table`(dt1, dt2) : \r\n  When i is a data.table (or character vector), x must be keyed (i.e. sorted, and, marked as sorted) so data.table knows which columns to join to and take advantage of x being sorted. Call setkey(x,...) first, see ?setkey.\r\n> dt1[dt2,on=c(\"y\"=\"y\")] # nice\r\n   x y z i.x i.z\r\n1: 1 2 1   1   3\r\n2: 2 3 2   2   4\r\n3: 3 4 3   3   5\r\n> dt1[dt2,on=c(\"x\"=\"x\")] # nice :)\r\n   x y z i.y i.z\r\n1: 1 2 1   2   3\r\n2: 2 3 2   3   4\r\n3: 3 4 3   4   5\r\n> dt1[dt2,on=c(\"ex\"=\"x\")] # erm..\r\nError in forderv(x, by = rightcols) : \r\n  'by' value -2147483648 out of range [1,3]\r\n> dt1[dt2,on=c(\"x\"=\"ex\")] # ...hm\r\nError in bmerge(i, x, leftcols, rightcols, io, xo, roll, rollends, nomatch,  : \r\n  Internal error. icols[0] is NA\r\n> dt1[dt2,on=c(\"y\"=\"why\")] # that's what she said\r\nError in bmerge(i, x, leftcols, rightcols, io, xo, roll, rollends, nomatch,  : \r\n  x.'y' is a character column being joined to i.'NA' which is type 'NULL'. Character columns must join to factor or character columns.\r\n````\r\n- [ ] reference to `on` in keyless join attempt error message\r\n- [ ] nice error if LHS in `on` columns do not exist in data table\r\n- [ ] nice error if RHS in `on` columns do not exist in `i` `data.table`\r\n\r\n\r\ncopyable code for above output:\r\n````\r\ndt1=data.table(x=1:3,y=as.character(2:4),z=1:3);dt2=data.table(x=1:3,y=as.character(2:4),z=3:5)\r\ndt1[dt2]\r\ndt1[dt2,on=c(\"y\"=\"y\")]\r\ndt1[dt2,on=c(\"x\"=\"x\")]\r\ndt1[dt2,on=c(\"ex\"=\"x\")]\r\ndt1[dt2,on=c(\"x\"=\"ex\")]\r\ndt1[dt2,on=c(\"y\"=\"why\")]\r\n````\r\n\r\nPlease feel free to copy this where it belongs if you think it's worth it and that this was not the right place.\r\nthanks again,\r\njan"}}