{"action":"closed","issue":{"url":"https://api.github.com/repos/hadley/dplyr/issues/1860","repository_url":"https://api.github.com/repos/hadley/dplyr","labels_url":"https://api.github.com/repos/hadley/dplyr/issues/1860/labels{/name}","comments_url":"https://api.github.com/repos/hadley/dplyr/issues/1860/comments","events_url":"https://api.github.com/repos/hadley/dplyr/issues/1860/events","html_url":"https://github.com/hadley/dplyr/issues/1860","id":157043903,"number":1860,"title":"Result of group_by + mutate depends on row order","user":{"login":"fedyakov","id":1201217,"avatar_url":"https://avatars.githubusercontent.com/u/1201217?v=3","gravatar_id":"","url":"https://api.github.com/users/fedyakov","html_url":"https://github.com/fedyakov","followers_url":"https://api.github.com/users/fedyakov/followers","following_url":"https://api.github.com/users/fedyakov/following{/other_user}","gists_url":"https://api.github.com/users/fedyakov/gists{/gist_id}","starred_url":"https://api.github.com/users/fedyakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedyakov/subscriptions","organizations_url":"https://api.github.com/users/fedyakov/orgs","repos_url":"https://api.github.com/users/fedyakov/repos","events_url":"https://api.github.com/users/fedyakov/events{/privacy}","received_events_url":"https://api.github.com/users/fedyakov/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-26T18:05:22Z","updated_at":"2016-05-26T18:09:24Z","closed_at":"2016-05-26T18:09:24Z","body":"Correct:\r\n```R\r\n> data.frame(k=c(0, 1), v=c(1, NA)) %>% group_by(k) %>% mutate(sum(v))\r\nSource: local data frame [2 x 3]\r\nGroups: k [2]\r\n\r\n      k     v sum(v)\r\n  (dbl) (dbl)  (dbl)\r\n1     0     1      1\r\n2     1    NA     NA\r\n```\r\nIncorrect (NA for 2nd group):\r\n```R\r\n> data.frame(k=c(0, 1), v=c(NA, 1)) %>% group_by(k) %>% mutate(sum(v))\r\nSource: local data frame [2 x 3]\r\nGroups: k [2]\r\n\r\n      k     v sum(v)\r\n  (dbl) (dbl)  (dbl)\r\n1     0    NA     NA\r\n2     1     1     NA\r\n```"}}
{"actor":{"display_login":"hadley"}}