{"action":"closed","issue":{"url":"https://api.github.com/repos/Rdatatable/data.table/issues/1013","labels_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1013/labels{/name}","comments_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1013/comments","events_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1013/events","html_url":"https://github.com/Rdatatable/data.table/issues/1013","id":54918297,"number":1013,"title":"Scoping of newly added columns","user":{"login":"kykuo","id":5582151,"avatar_url":"https://avatars.githubusercontent.com/u/5582151?v=3","gravatar_id":"","url":"https://api.github.com/users/kykuo","html_url":"https://github.com/kykuo","followers_url":"https://api.github.com/users/kykuo/followers","following_url":"https://api.github.com/users/kykuo/following{/other_user}","gists_url":"https://api.github.com/users/kykuo/gists{/gist_id}","starred_url":"https://api.github.com/users/kykuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kykuo/subscriptions","organizations_url":"https://api.github.com/users/kykuo/orgs","repos_url":"https://api.github.com/users/kykuo/repos","events_url":"https://api.github.com/users/kykuo/events{/privacy}","received_events_url":"https://api.github.com/users/kykuo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Rdatatable/data.table/labels/question","name":"question","color":"FAA743"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-20T18:10:50Z","updated_at":"2015-01-21T03:07:39Z","closed_at":"2015-01-21T03:07:39Z","body":"Suppose I'm trying to add a couple columns where one depends on the other. It seems like I have two options:\r\n\r\n```\r\ndata.table(iris)[\r\n  , c(\"x\", \"y\") := {\r\n    x  <-  Sepal.Length * 2;\r\n    y  <-  x^2;\r\n    list(x, y)\r\n    }][]\r\n```\r\n\r\nand\r\n\r\n```\r\ndata.table(iris)[\r\n  , x := Sepal.Length * 2][\r\n    , y := x^2][]\r\n```\r\n\r\nI don't think either of these are elegant, and what I was hoping for is something like\r\n\r\n```\r\ndata.table(iris)[\r\n  ,`:=`(\r\n    x = Sepal.Length *2,\r\n    y = x^2)]\r\n```\r\n\r\nWhich avoids curly braces, and adds the columns in the same bracket.\r\n\r\nIs there a better way to do this, and, if not, why not?"}}