{"action":"closed","issue":{"url":"https://api.github.com/repos/tidyverse/dplyr/issues/3510","repository_url":"https://api.github.com/repos/tidyverse/dplyr","labels_url":"https://api.github.com/repos/tidyverse/dplyr/issues/3510/labels{/name}","comments_url":"https://api.github.com/repos/tidyverse/dplyr/issues/3510/comments","events_url":"https://api.github.com/repos/tidyverse/dplyr/issues/3510/events","html_url":"https://github.com/tidyverse/dplyr/issues/3510","id":313754832,"node_id":"MDU6SXNzdWUzMTM3NTQ4MzI=","number":3510,"title":"Better tracebacks","user":{"login":"krlmlr","id":1741643,"node_id":"MDQ6VXNlcjE3NDE2NDM=","avatar_url":"https://avatars0.githubusercontent.com/u/1741643?v=4","gravatar_id":"","url":"https://api.github.com/users/krlmlr","html_url":"https://github.com/krlmlr","followers_url":"https://api.github.com/users/krlmlr/followers","following_url":"https://api.github.com/users/krlmlr/following{/other_user}","gists_url":"https://api.github.com/users/krlmlr/gists{/gist_id}","starred_url":"https://api.github.com/users/krlmlr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krlmlr/subscriptions","organizations_url":"https://api.github.com/users/krlmlr/orgs","repos_url":"https://api.github.com/users/krlmlr/repos","events_url":"https://api.github.com/users/krlmlr/events{/privacy}","received_events_url":"https://api.github.com/users/krlmlr/received_events","type":"User","site_admin":false},"labels":[{"id":276202384,"node_id":"MDU6TGFiZWwyNzYyMDIzODQ=","url":"https://api.github.com/repos/tidyverse/dplyr/labels/data%20frame","name":"data frame","color":"eeeeee","default":false},{"id":17708200,"node_id":"MDU6TGFiZWwxNzcwODIwMA==","url":"https://api.github.com/repos/tidyverse/dplyr/labels/feature","name":"feature","color":"009800","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-04-12T14:35:04Z","updated_at":"2018-06-11T13:11:20Z","closed_at":"2018-06-11T13:11:19Z","author_association":"MEMBER","body":"When a complex expression inside `mutate()` or most other verbs fails, the traceback is not informative:\r\n\r\n``` r\r\nlibrary(tidyverse)\r\nf <- function(x) if (x < 3) 5 else g()\r\ng <- function() stop(\"oops\")\r\ntibble(a = 1:10) %>% group_by(a) %>% mutate(b = f(a))\r\n#> Error in mutate_impl(.data, dots): Evaluation error: oops.\r\n```\r\n\r\n> Created on 2018-04-12 by the [reprex package](http://reprex.tidyverse.org) (v0.2.0).\r\n\r\nIt does contain the error message, but not the location. I wonder if the traceback can be made available.\r\n\r\nIf not, we could fix this by creating unrolled optimized R code in the C++ part, which then is passed to the R evaluator, and then transforming the results in C++ again:\r\n\r\n```r\r\nmutate <- function(.data, ...) {\r\n  code <- unroll_mutate(.data, !!!quos(...))\r\n  res <- eval(code)\r\n  apply_mutate(.data, res)\r\n}\r\n```"}}
{"actor":{"display_login":"romainfrancois"}}