{"action":"created","issue":{"url":"https://api.github.com/repos/jennybc/reprex/issues/11","labels_url":"https://api.github.com/repos/jennybc/reprex/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/jennybc/reprex/issues/11/comments","events_url":"https://api.github.com/repos/jennybc/reprex/issues/11/events","html_url":"https://github.com/jennybc/reprex/issues/11","id":103568052,"number":11,"title":"It's possible to create non-reproducible examples since we knit with the user's environment","user":{"login":"dgrtwo","id":994718,"avatar_url":"https://avatars.githubusercontent.com/u/994718?v=3","gravatar_id":"","url":"https://api.github.com/users/dgrtwo","html_url":"https://github.com/dgrtwo","followers_url":"https://api.github.com/users/dgrtwo/followers","following_url":"https://api.github.com/users/dgrtwo/following{/other_user}","gists_url":"https://api.github.com/users/dgrtwo/gists{/gist_id}","starred_url":"https://api.github.com/users/dgrtwo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgrtwo/subscriptions","organizations_url":"https://api.github.com/users/dgrtwo/orgs","repos_url":"https://api.github.com/users/dgrtwo/repos","events_url":"https://api.github.com/users/dgrtwo/events{/privacy}","received_events_url":"https://api.github.com/users/dgrtwo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-08-27T18:31:33Z","updated_at":"2015-09-15T09:35:12Z","closed_at":null,"body":"For instance:\r\n\r\n    y <- 10\r\n    reprex(y + 1)\r\n\r\nproduces\r\n\r\n``` r\r\ny + 1\r\n#> [1] 11\r\n```\r\n\r\nTo fix, we could add the argument `envir = new.env()` to the render function (I can add to my PR #6 )"},"comment":{"url":"https://api.github.com/repos/jennybc/reprex/issues/comments/140337194","html_url":"https://github.com/jennybc/reprex/issues/11#issuecomment-140337194","issue_url":"https://api.github.com/repos/jennybc/reprex/issues/11","id":140337194,"user":{"login":"klmr","id":38931,"avatar_url":"https://avatars.githubusercontent.com/u/38931?v=3","gravatar_id":"","url":"https://api.github.com/users/klmr","html_url":"https://github.com/klmr","followers_url":"https://api.github.com/users/klmr/followers","following_url":"https://api.github.com/users/klmr/following{/other_user}","gists_url":"https://api.github.com/users/klmr/gists{/gist_id}","starred_url":"https://api.github.com/users/klmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klmr/subscriptions","organizations_url":"https://api.github.com/users/klmr/orgs","repos_url":"https://api.github.com/users/klmr/repos","events_url":"https://api.github.com/users/klmr/events{/privacy}","received_events_url":"https://api.github.com/users/klmr/received_events","type":"User","site_admin":false},"created_at":"2015-09-15T09:35:12Z","updated_at":"2015-09-15T09:35:12Z","body":"I think my amended answer on Stack Overflow should solve this problem.\r\n\r\nBut more philosophically, I would actually have expected the `reprex` function to work slightly differently:\r\n\r\nGiven the following input\r\n\r\n```r\r\nx = 2\r\ny = 3\r\nreprex(x + 1)\r\n```\r\n\r\nI intuitively would have expected `reprex` to pull all dependencies (but *only* those actually used — here: `x` but not `y`) into the resulting example. In other words, the output for the above would be:\r\n\r\n    ``` r\r\n    x <- 2\r\n    x + 1\r\n    #> [1] 3\r\n    ```\r\n\r\nHowever, implementing this is definitely not trivial."}}