{"action":"created","issue":{"url":"https://api.github.com/repos/tidyverse/dplyr/issues/2911","repository_url":"https://api.github.com/repos/tidyverse/dplyr","labels_url":"https://api.github.com/repos/tidyverse/dplyr/issues/2911/labels{/name}","comments_url":"https://api.github.com/repos/tidyverse/dplyr/issues/2911/comments","events_url":"https://api.github.com/repos/tidyverse/dplyr/issues/2911/events","html_url":"https://github.com/tidyverse/dplyr/issues/2911","id":238403155,"number":2911,"title":"mutate_at not working with group_by","user":{"login":"andresimi","id":7464255,"avatar_url":"https://avatars0.githubusercontent.com/u/7464255?v=4","gravatar_id":"","url":"https://api.github.com/users/andresimi","html_url":"https://github.com/andresimi","followers_url":"https://api.github.com/users/andresimi/followers","following_url":"https://api.github.com/users/andresimi/following{/other_user}","gists_url":"https://api.github.com/users/andresimi/gists{/gist_id}","starred_url":"https://api.github.com/users/andresimi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andresimi/subscriptions","organizations_url":"https://api.github.com/users/andresimi/orgs","repos_url":"https://api.github.com/users/andresimi/repos","events_url":"https://api.github.com/users/andresimi/events{/privacy}","received_events_url":"https://api.github.com/users/andresimi/received_events","type":"User","site_admin":false},"labels":[{"id":17708198,"url":"https://api.github.com/repos/tidyverse/dplyr/labels/bug","name":"bug","color":"e02a2a","default":true},{"id":276202384,"url":"https://api.github.com/repos/tidyverse/dplyr/labels/data%20frame","name":"data frame","color":"eeeeee","default":false}],"state":"open","locked":false,"assignee":{"login":"lionel-","id":4465050,"avatar_url":"https://avatars2.githubusercontent.com/u/4465050?v=4","gravatar_id":"","url":"https://api.github.com/users/lionel-","html_url":"https://github.com/lionel-","followers_url":"https://api.github.com/users/lionel-/followers","following_url":"https://api.github.com/users/lionel-/following{/other_user}","gists_url":"https://api.github.com/users/lionel-/gists{/gist_id}","starred_url":"https://api.github.com/users/lionel-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lionel-/subscriptions","organizations_url":"https://api.github.com/users/lionel-/orgs","repos_url":"https://api.github.com/users/lionel-/repos","events_url":"https://api.github.com/users/lionel-/events{/privacy}","received_events_url":"https://api.github.com/users/lionel-/received_events","type":"User","site_admin":false},"assignees":[{"login":"lionel-","id":4465050,"avatar_url":"https://avatars2.githubusercontent.com/u/4465050?v=4","gravatar_id":"","url":"https://api.github.com/users/lionel-","html_url":"https://github.com/lionel-","followers_url":"https://api.github.com/users/lionel-/followers","following_url":"https://api.github.com/users/lionel-/following{/other_user}","gists_url":"https://api.github.com/users/lionel-/gists{/gist_id}","starred_url":"https://api.github.com/users/lionel-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lionel-/subscriptions","organizations_url":"https://api.github.com/users/lionel-/orgs","repos_url":"https://api.github.com/users/lionel-/repos","events_url":"https://api.github.com/users/lionel-/events{/privacy}","received_events_url":"https://api.github.com/users/lionel-/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2017-06-25T20:12:47Z","updated_at":"2018-03-16T22:03:54Z","closed_at":null,"author_association":"NONE","body":"Mutate_at not working when used with group_by function.\r\n\r\n```r\r\nmtcars %>% as.tibble()\r\n\r\n# A tibble: 32 x 11\r\n     mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb\r\n * <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>\r\n 1  21.0     6 160.0   110  3.90 2.620 16.46     0     1     4     4\r\n 2  21.0     6 160.0   110  3.90 2.875 17.02     0     1     4     4\r\n 3  22.8     4 108.0    93  3.85 2.320 18.61     1     1     4     1\r\n 4  21.4     6 258.0   110  3.08 3.215 19.44     1     0     3     1\r\n 5  18.7     8 360.0   175  3.15 3.440 17.02     0     0     3     2\r\n 6  18.1     6 225.0   105  2.76 3.460 20.22     1     0     3     1\r\n 7  14.3     8 360.0   245  3.21 3.570 15.84     0     0     3     4\r\n 8  24.4     4 146.7    62  3.69 3.190 20.00     1     0     4     2\r\n 9  22.8     4 140.8    95  3.92 3.150 22.90     1     0     4     2\r\n10  19.2     6 167.6   123  3.92 3.440 18.30     1     0     4     4\r\n# ... with 22 more rows\r\n```\r\nVariable gear is numeric\r\n```r\r\nmtcars%>% as.tibble()%>% mutate_at(vars(gear),as.factor)\r\n# A tibble: 32 x 11\r\n     mpg   cyl  disp    hp  drat    wt  qsec    vs    am   gear  carb\r\n   <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <fctr> <dbl>\r\n 1  21.0     6 160.0   110  3.90 2.620 16.46     0     1      4     4\r\n 2  21.0     6 160.0   110  3.90 2.875 17.02     0     1      4     4\r\n 3  22.8     4 108.0    93  3.85 2.320 18.61     1     1      4     1\r\n 4  21.4     6 258.0   110  3.08 3.215 19.44     1     0      3     1\r\n 5  18.7     8 360.0   175  3.15 3.440 17.02     0     0      3     2\r\n 6  18.1     6 225.0   105  2.76 3.460 20.22     1     0      3     1\r\n 7  14.3     8 360.0   245  3.21 3.570 15.84     0     0      3     4\r\n 8  24.4     4 146.7    62  3.69 3.190 20.00     1     0      4     2\r\n 9  22.8     4 140.8    95  3.92 3.150 22.90     1     0      4     2\r\n10  19.2     6 167.6   123  3.92 3.440 18.30     1     0      4     4\r\n# ... with 22 more rows\r\n```\r\nMutate_at works, gear now is a factor and no erros are shwon.\r\n```r\r\nmtcars%>% group_by(cyl)%>% mutate_at(vars(gear),as.factor)\r\n\r\n# A tibble: 32 x 11\r\n# Groups:   cyl [3]\r\n     mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb\r\n   <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <dbl>\r\n 1  21.0     6 160.0   110  3.90 2.620 16.46     0     1     4     4\r\n 2  21.0     6 160.0   110  3.90 2.875 17.02     0     1     4     4\r\n 3  22.8     4 108.0    93  3.85 2.320 18.61     1     1     4     1\r\n 4  21.4     6 258.0   110  3.08 3.215 19.44     1     0     3     1\r\n 5  18.7     8 360.0   175  3.15 3.440 17.02     0     0     3     2\r\n 6  18.1     6 225.0   105  2.76 3.460 20.22     1     0     3     1\r\n 7  14.3     8 360.0   245  3.21 3.570 15.84     0     0     3     4\r\n 8  24.4     4 146.7    62  3.69 3.190 20.00     1     0     4     2\r\n 9  22.8     4 140.8    95  3.92 3.150 22.90     1     0     4     2\r\n10  19.2     6 167.6   123  3.92 3.440 18.30     1     0     4     4\r\n# ... with 22 more rows\r\nWarning messages:\r\n1: In mutate_impl(.data, dots) :\r\n  Unequal factor levels: coercing to character\r\n2: In mutate_impl(.data, dots) :\r\n  binding character and factor vector, coercing into character vector\r\n3: In mutate_impl(.data, dots) :\r\n  binding character and factor vector, coercing into character vector\r\n```\r\nHowever, when mutate_at is preceded by group_by, this erros apears and gear is a now a character...\r\n"},"comment":{"url":"https://api.github.com/repos/tidyverse/dplyr/issues/comments/373857257","html_url":"https://github.com/tidyverse/dplyr/issues/2911#issuecomment-373857257","issue_url":"https://api.github.com/repos/tidyverse/dplyr/issues/2911","id":373857257,"user":{"login":"krlmlr","id":1741643,"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},"created_at":"2018-03-16T22:03:54Z","updated_at":"2018-03-16T22:03:54Z","author_association":"MEMBER","body":"Worked in 0.5.0, first occurrence in 0.7.0. Determined with:\r\n\r\n```sh\r\narchive/run-all.sh R -q -e 'suppressPackageStartupMessages(library(dplyr)); mtcars%>% group_by(cyl)%>% mutate(gear = factor(gear))'\r\n```\r\n"}}
{"actor":{"display_login":"krlmlr"}}