{"action":"created","issue":{"url":"https://api.github.com/repos/tidyverse/dplyr/issues/3489","repository_url":"https://api.github.com/repos/tidyverse/dplyr","labels_url":"https://api.github.com/repos/tidyverse/dplyr/issues/3489/labels{/name}","comments_url":"https://api.github.com/repos/tidyverse/dplyr/issues/3489/comments","events_url":"https://api.github.com/repos/tidyverse/dplyr/issues/3489/events","html_url":"https://github.com/tidyverse/dplyr/issues/3489","id":312580064,"number":3489,"title":"tidy grouped data attributes","user":{"login":"romainfrancois","id":2625526,"avatar_url":"https://avatars3.githubusercontent.com/u/2625526?v=4","gravatar_id":"","url":"https://api.github.com/users/romainfrancois","html_url":"https://github.com/romainfrancois","followers_url":"https://api.github.com/users/romainfrancois/followers","following_url":"https://api.github.com/users/romainfrancois/following{/other_user}","gists_url":"https://api.github.com/users/romainfrancois/gists{/gist_id}","starred_url":"https://api.github.com/users/romainfrancois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romainfrancois/subscriptions","organizations_url":"https://api.github.com/users/romainfrancois/orgs","repos_url":"https://api.github.com/users/romainfrancois/repos","events_url":"https://api.github.com/users/romainfrancois/events{/privacy}","received_events_url":"https://api.github.com/users/romainfrancois/received_events","type":"User","site_admin":false},"labels":[{"id":873708411,"url":"https://api.github.com/repos/tidyverse/dplyr/labels/architecture","name":"architecture","color":"eeeeee","default":false},{"id":906454084,"url":"https://api.github.com/repos/tidyverse/dplyr/labels/breaking%20:skull_and_crossbones:","name":"breaking :skull_and_crossbones:","color":"d93f0b","default":false},{"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":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/tidyverse/dplyr/milestones/14","html_url":"https://github.com/tidyverse/dplyr/milestone/14","labels_url":"https://api.github.com/repos/tidyverse/dplyr/milestones/14/labels","id":3317487,"number":14,"title":"0.8.0","description":"","creator":{"login":"romainfrancois","id":2625526,"avatar_url":"https://avatars3.githubusercontent.com/u/2625526?v=4","gravatar_id":"","url":"https://api.github.com/users/romainfrancois","html_url":"https://github.com/romainfrancois","followers_url":"https://api.github.com/users/romainfrancois/followers","following_url":"https://api.github.com/users/romainfrancois/following{/other_user}","gists_url":"https://api.github.com/users/romainfrancois/gists{/gist_id}","starred_url":"https://api.github.com/users/romainfrancois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romainfrancois/subscriptions","organizations_url":"https://api.github.com/users/romainfrancois/orgs","repos_url":"https://api.github.com/users/romainfrancois/repos","events_url":"https://api.github.com/users/romainfrancois/events{/privacy}","received_events_url":"https://api.github.com/users/romainfrancois/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":0,"state":"open","created_at":"2018-05-03T11:43:09Z","updated_at":"2018-05-08T14:19:34Z","due_on":null,"closed_at":null},"comments":9,"created_at":"2018-04-09T15:34:37Z","updated_at":"2018-05-09T15:45:11Z","closed_at":null,"author_association":"COLLABORATOR","body":"Would it make sense to tidy attributes that we use internally for grouped data frame, we could e.g. have labels, indices and indices sizes in the same data frame, which would be convenient for manipulation because then it's tidy. (inspired by working on #341). \r\n\r\n``` r\r\nlibrary(dplyr)\r\n#> \r\n#> Attaching package: 'dplyr'\r\n#> The following objects are masked from 'package:stats':\r\n#> \r\n#>     filter, lag\r\n#> The following objects are masked from 'package:base':\r\n#> \r\n#>     intersect, setdiff, setequal, union\r\ndf <- data.frame(x = 1:2, y = factor(c(1, 1), levels = 1:2))\r\ngdf <- group_by(df, x, y)\r\n\r\nattributes(gdf)[ c(\"labels\", \"indices\", \"group_sizes\")]\r\n#> $labels\r\n#>   x y\r\n#> 1 1 1\r\n#> 2 2 1\r\n#> \r\n#> $indices\r\n#> $indices[[1]]\r\n#> [1] 0\r\n#> \r\n#> $indices[[2]]\r\n#> [1] 1\r\n#> \r\n#> \r\n#> $group_sizes\r\n#> [1] 1 1\r\nas_tibble(\r\n  mutate( attr(gdf, \"labels\"), \r\n    ..index.. = attr(gdf, \"indices\"), \r\n    ..size.. = attr(gdf, \"group_sizes\")\r\n  )\r\n)\r\n#> # A tibble: 2 x 4\r\n#>       x y     ..index.. ..size..\r\n#>   <int> <fct> <list>       <int>\r\n#> 1     1 1     <int [1]>        1\r\n#> 2     2 1     <int [1]>        1\r\n```\r\n\r\nCreated on 2018-04-09 by the [reprex package](http://reprex.tidyverse.org) (v0.2.0)."},"comment":{"url":"https://api.github.com/repos/tidyverse/dplyr/issues/comments/387784052","html_url":"https://github.com/tidyverse/dplyr/issues/3489#issuecomment-387784052","issue_url":"https://api.github.com/repos/tidyverse/dplyr/issues/3489","id":387784052,"user":{"login":"romainfrancois","id":2625526,"avatar_url":"https://avatars3.githubusercontent.com/u/2625526?v=4","gravatar_id":"","url":"https://api.github.com/users/romainfrancois","html_url":"https://github.com/romainfrancois","followers_url":"https://api.github.com/users/romainfrancois/followers","following_url":"https://api.github.com/users/romainfrancois/following{/other_user}","gists_url":"https://api.github.com/users/romainfrancois/gists{/gist_id}","starred_url":"https://api.github.com/users/romainfrancois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romainfrancois/subscriptions","organizations_url":"https://api.github.com/users/romainfrancois/orgs","repos_url":"https://api.github.com/users/romainfrancois/repos","events_url":"https://api.github.com/users/romainfrancois/events{/privacy}","received_events_url":"https://api.github.com/users/romainfrancois/received_events","type":"User","site_admin":false},"created_at":"2018-05-09T15:45:11Z","updated_at":"2018-05-09T15:45:11Z","author_association":"COLLABORATOR","body":"preserving in the context of joins might be tricky because: \r\n\r\n- mixed grouping, e.g when the lhs is a factor and the rhs a chr\r\n- for right joins and any joins where the lhs is not in control of the group population. \r\n"}}
{"actor":{"display_login":"romainfrancois"}}