{"action":"created","issue":{"url":"https://api.github.com/repos/HenrikBengtsson/listenv/issues/2","labels_url":"https://api.github.com/repos/HenrikBengtsson/listenv/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/HenrikBengtsson/listenv/issues/2/comments","events_url":"https://api.github.com/repos/HenrikBengtsson/listenv/issues/2/events","html_url":"https://github.com/HenrikBengtsson/listenv/issues/2","id":98153976,"number":2,"title":"Add x[subset] to effectively be short for as.list(x)[subset]?","user":{"login":"HenrikBengtsson","id":1616850,"avatar_url":"https://avatars.githubusercontent.com/u/1616850?v=3","gravatar_id":"","url":"https://api.github.com/users/HenrikBengtsson","html_url":"https://github.com/HenrikBengtsson","followers_url":"https://api.github.com/users/HenrikBengtsson/followers","following_url":"https://api.github.com/users/HenrikBengtsson/following{/other_user}","gists_url":"https://api.github.com/users/HenrikBengtsson/gists{/gist_id}","starred_url":"https://api.github.com/users/HenrikBengtsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HenrikBengtsson/subscriptions","organizations_url":"https://api.github.com/users/HenrikBengtsson/orgs","repos_url":"https://api.github.com/users/HenrikBengtsson/repos","events_url":"https://api.github.com/users/HenrikBengtsson/events{/privacy}","received_events_url":"https://api.github.com/users/HenrikBengtsson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/HenrikBengtsson/listenv/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/HenrikBengtsson/listenv/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-30T12:08:36Z","updated_at":"2015-08-03T00:49:47Z","closed_at":"2015-08-03T00:49:47Z","body":"# Question\r\nTo better emulate list:s, should subsetting via `[` also be supported?\r\n\r\n# Example\r\nCurrently, we get:\r\n```r\r\n> x <- listenv()\r\n> x$a <- 1\r\n> x$b <- 2\r\n> x$c <- 3\r\n> as.list(x)[2:3]\r\n$b\r\n[1] 2\r\n\r\n$c\r\n[1] 3\r\n\r\n> x[2:3]\r\nError in x[2:3] : object of type 'environment' is not subsettable\r\n```\r\nAfter adding support for `[`, we should get a list:\r\n```r\r\n> x[2:3]\r\n$b\r\n[1] 2\r\n\r\n$c\r\n[1] 3\r\n```\r\n...or a list environment?  (see below).\r\n# Requirements\r\n* To minimize overhead, and to avoid blocking scenarios (e.g. via futures), the subsetting should implemented such that only the elements requested are queried/touched/retrieved and all other are ignored.\r\n\r\n* Should it return a `list` or a `listenv`?  Note that it is not possible to return a `listenv` while not _copying_ the elements.  In other words, doing `y <- x[1:2]; y[1] <- 4` will not change `x[1]`.  Because of this, does it make more sense to return a `list`?  Also, note that `environment` cannot be subetted; if they would then `listenv` would also be subsettable automatically."},"comment":{"url":"https://api.github.com/repos/HenrikBengtsson/listenv/issues/comments/127092255","html_url":"https://github.com/HenrikBengtsson/listenv/issues/2#issuecomment-127092255","issue_url":"https://api.github.com/repos/HenrikBengtsson/listenv/issues/2","id":127092255,"user":{"login":"HenrikBengtsson","id":1616850,"avatar_url":"https://avatars.githubusercontent.com/u/1616850?v=3","gravatar_id":"","url":"https://api.github.com/users/HenrikBengtsson","html_url":"https://github.com/HenrikBengtsson","followers_url":"https://api.github.com/users/HenrikBengtsson/followers","following_url":"https://api.github.com/users/HenrikBengtsson/following{/other_user}","gists_url":"https://api.github.com/users/HenrikBengtsson/gists{/gist_id}","starred_url":"https://api.github.com/users/HenrikBengtsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HenrikBengtsson/subscriptions","organizations_url":"https://api.github.com/users/HenrikBengtsson/orgs","repos_url":"https://api.github.com/users/HenrikBengtsson/repos","events_url":"https://api.github.com/users/HenrikBengtsson/events{/privacy}","received_events_url":"https://api.github.com/users/HenrikBengtsson/received_events","type":"User","site_admin":false},"created_at":"2015-08-03T00:49:47Z","updated_at":"2015-08-03T00:49:47Z","body":"Decided to have `x[1:3]` return a list environment."}}