{"action":"created","issue":{"url":"https://api.github.com/repos/Rdatatable/data.table/issues/1893","repository_url":"https://api.github.com/repos/Rdatatable/data.table","labels_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1893/labels{/name}","comments_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1893/comments","events_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1893/events","html_url":"https://github.com/Rdatatable/data.table/issues/1893","id":185932603,"node_id":"MDU6SXNzdWUxODU5MzI2MDM=","number":1893,"title":"Automatic reference to columns in the selected data.table with set()","user":{"login":"hannes101","id":11256578,"node_id":"MDQ6VXNlcjExMjU2NTc4","avatar_url":"https://avatars0.githubusercontent.com/u/11256578?v=4","gravatar_id":"","url":"https://api.github.com/users/hannes101","html_url":"https://github.com/hannes101","followers_url":"https://api.github.com/users/hannes101/followers","following_url":"https://api.github.com/users/hannes101/following{/other_user}","gists_url":"https://api.github.com/users/hannes101/gists{/gist_id}","starred_url":"https://api.github.com/users/hannes101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hannes101/subscriptions","organizations_url":"https://api.github.com/users/hannes101/orgs","repos_url":"https://api.github.com/users/hannes101/repos","events_url":"https://api.github.com/users/hannes101/events{/privacy}","received_events_url":"https://api.github.com/users/hannes101/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-28T14:09:43Z","updated_at":"2018-08-20T04:39:20Z","closed_at":"2018-08-20T04:39:20Z","author_association":"NONE","body":"I came across an issue, that in the case of set combined with which() in the i clause one needs to explicitly call the data.table and the column name and not just the column name. Isn't the latter not kind of an expected behavior? At least for me it would be more natural to just use the following, since in the first argument the data.table actually is defined already and therefore all selections should only be in reference to that data.table, or?\r\n`set(dt1, i = which(OilWellID == 3), j = \"Invest.Period\", value = 756)`\r\nInstead it's necessary to explicitly add the call like this:\r\n`set(dt , i = which(dt[[\"Abandon.Period\"]] == 2270L), j = 2L, value = 1L)`\r\n\r\nIs it possible to implement the first option as well or is it just not possible?\r\n\r\nFor a reproducible examples, please see:\r\nhttps://stackoverflow.com/questions/40304286/setting-a-value-in-a-data-table-with-set-debugging\r\ndata.table version is 1.9.6 \r\nR 3.3.0\r\nThanks for data.table!\r\n"},"comment":{"url":"https://api.github.com/repos/Rdatatable/data.table/issues/comments/414195358","html_url":"https://github.com/Rdatatable/data.table/issues/1893#issuecomment-414195358","issue_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1893","id":414195358,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDE5NTM1OA==","user":{"login":"jangorecki","id":3627377,"node_id":"MDQ6VXNlcjM2MjczNzc=","avatar_url":"https://avatars3.githubusercontent.com/u/3627377?v=4","gravatar_id":"","url":"https://api.github.com/users/jangorecki","html_url":"https://github.com/jangorecki","followers_url":"https://api.github.com/users/jangorecki/followers","following_url":"https://api.github.com/users/jangorecki/following{/other_user}","gists_url":"https://api.github.com/users/jangorecki/gists{/gist_id}","starred_url":"https://api.github.com/users/jangorecki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jangorecki/subscriptions","organizations_url":"https://api.github.com/users/jangorecki/orgs","repos_url":"https://api.github.com/users/jangorecki/repos","events_url":"https://api.github.com/users/jangorecki/events{/privacy}","received_events_url":"https://api.github.com/users/jangorecki/received_events","type":"User","site_admin":false},"created_at":"2018-08-20T04:39:20Z","updated_at":"2018-08-20T04:39:20Z","author_association":"MEMBER","body":"I don't think we should be putting `with` functionality into `set` function, and making it NSE.\r\nAlthough it annoys me also from time to time, but the proper way is to rewrite `[` to C and to avoid current overhead. Closing for now."}}
{"actor":{"display_login":"jangorecki"}}