{"action":"created","issue":{"url":"https://api.github.com/repos/Rdatatable/data.table/issues/1352","labels_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1352/labels{/name}","comments_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1352/comments","events_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1352/events","html_url":"https://github.com/Rdatatable/data.table/issues/1352","id":107749011,"number":1352,"title":"Data tables won't merge if by argument has names","user":{"login":"sebastian-c","id":1818581,"avatar_url":"https://avatars.githubusercontent.com/u/1818581?v=3","gravatar_id":"","url":"https://api.github.com/users/sebastian-c","html_url":"https://github.com/sebastian-c","followers_url":"https://api.github.com/users/sebastian-c/followers","following_url":"https://api.github.com/users/sebastian-c/following{/other_user}","gists_url":"https://api.github.com/users/sebastian-c/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastian-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastian-c/subscriptions","organizations_url":"https://api.github.com/users/sebastian-c/orgs","repos_url":"https://api.github.com/users/sebastian-c/repos","events_url":"https://api.github.com/users/sebastian-c/events{/privacy}","received_events_url":"https://api.github.com/users/sebastian-c/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-22T16:17:04Z","updated_at":"2015-09-22T16:19:55Z","closed_at":null,"body":"I've been trying the merge some data tables, but it seems that if the 'by' argument has names, they won't merge, giving an error: \r\n\r\n`Error in forderv(x, by = rightcols) :  'by' value -2147483648 out of range [1,8]`\r\n\r\nI've managed to make as small an example as I can to reproduce the error:\r\n````\r\ntab1 <- structure(list(a = c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, \r\n3L, 3L, 3L, 3L, 3L, NA), b = c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \r\n2, 2, 2, 2, 2, NA), c = c(2010L, 2011L, 2012L, 2013L, 2014L, \r\n2010L, 2011L, 2012L, 2013L, 2014L, 2010L, 2011L, 2012L, 2013L, \r\n2014L, NA), d = c(-0.625996555127917, 0.325673822554901, 1.68461340609045, \r\n-2.09358233735785, -0.444517113337327, 0.247434396526436, -0.595608214998598, \r\n0.779085729216547, 0.343640797995949, -1.03199833192338, 0.499177323692263, \r\n0.142404120359858, 0.124892949669588, 0.28962454726758, 1.45581442296567, \r\n1.27173157262308), e = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, \r\nNA, NA, NA, NA, NA, NA, NA), f = c(NA, NA, NA, NA, NA, NA, NA, \r\nNA, NA, NA, NA, NA, NA, NA, NA, NA), g = c(NA, NA, NA, NA, NA, \r\nNA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), h = c(1.82940602609317, \r\n0.337391723803077, 1.49770018138232, -0.353146958400835, 1.09995073678083, \r\n-0.578792240046591, 1.55076285478448, 0.919702101279719, 1.91852234353312, \r\n0.902454834121264, -1.37138551168091, 0.416357331689734, 0.306641948600609, \r\n-1.1230027058004, -0.621123012856139, 0.645928414645345)), .Names = c(\"a\", \r\n\"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\"), row.names = c(NA, -16L), class = \"data.frame\")\r\n\r\ntab2 <- structure(list(a = c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, \r\n3L, 3L, 3L, 3L, 3L, NA), b = c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \r\n2, 2, 2, 2, 2, NA), c = c(2010L, 2011L, 2012L, 2013L, 2014L, \r\n2010L, 2011L, 2012L, 2013L, 2014L, 2010L, 2011L, 2012L, 2013L, \r\n2014L, NA), D = structure(c(1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, \r\n2L, 1L, 1L, 1L, 1L, 2L, NA), .Label = c(\"\", \"M\"), class = \"factor\"), \r\n    E = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, \r\n    NA, NA, NA), F = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, \r\n    NA, NA, NA, NA, NA, NA), G = c(NA, NA, NA, NA, NA, NA, NA, \r\n    NA, NA, NA, NA, NA, NA, NA, NA, NA), H = structure(c(1L, \r\n    1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, NA\r\n    ), .Label = c(\"\", \"M\"), class = \"factor\")), .Names = c(\"a\", \r\n\"b\", \"c\", \"D\", \"E\", \"F\", \"G\", \"H\"), row.names = c(NA, -16L), class = \"data.frame\")\r\n\r\ntab1 <- data.table(tab1)\r\ntab2 <- data.table(tab2)\r\n\r\nkeys <- c(\"a\", \"b\", \"c\")\r\n\r\nmerge(tab1, tab2, by=keys)\r\nnames(keys) <- letters[24:26]\r\n\r\nmerge(tab1, tab2, by=keys)\r\n````\r\n\r\nNotice that the first merge works, but the second merge gives the aforementioned error."},"comment":{"url":"https://api.github.com/repos/Rdatatable/data.table/issues/comments/142338913","html_url":"https://github.com/Rdatatable/data.table/issues/1352#issuecomment-142338913","issue_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1352","id":142338913,"user":{"login":"franknarf1","id":4649190,"avatar_url":"https://avatars.githubusercontent.com/u/4649190?v=3","gravatar_id":"","url":"https://api.github.com/users/franknarf1","html_url":"https://github.com/franknarf1","followers_url":"https://api.github.com/users/franknarf1/followers","following_url":"https://api.github.com/users/franknarf1/following{/other_user}","gists_url":"https://api.github.com/users/franknarf1/gists{/gist_id}","starred_url":"https://api.github.com/users/franknarf1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/franknarf1/subscriptions","organizations_url":"https://api.github.com/users/franknarf1/orgs","repos_url":"https://api.github.com/users/franknarf1/repos","events_url":"https://api.github.com/users/franknarf1/events{/privacy}","received_events_url":"https://api.github.com/users/franknarf1/received_events","type":"User","site_admin":false},"created_at":"2015-09-22T16:19:55Z","updated_at":"2015-09-22T16:19:55Z","body":"If you instead use\r\n\r\n    names(keys) <- keys\r\n\r\nthe merge goes through fine. Presumably, the the names are used in some (as yet undocumented) way."}}