{"action":"created","comment":{"url":"https://api.github.com/repos/tidyverse/dplyr/pulls/comments/134807661","pull_request_review_id":58144034,"id":134807661,"diff_hunk":"@@ -1,20 +1,37 @@\n context(\"Mutate - windowed\")\n \n test_that(\"desc is correctly handled by window functions\", {\n-  df <- data.frame(x = 1:10, y = seq(1, 10, by = 1), g = rep(c(1, 2), each = 5))\n+  df <- data.frame(x = 1:10, y = seq(1, 10, by = 1),\n+                   g = rep(c(1, 2), each = 5), s = c(letters[1:3], LETTERS[1:5], letters[4:5]))\n \n   expect_equal(mutate(df, rank = min_rank(desc(x)))$rank, 10:1)\n   expect_equal(mutate(group_by(df, g), rank = min_rank(desc(x)))$rank, rep(5:1, 2))\n \n   expect_equal(mutate(df, rank = row_number(desc(x)))$rank, 10:1)\n   expect_equal(mutate(group_by(df, g), rank = row_number(desc(x)))$rank, rep(5:1, 2))\n \n+  # Test character vector sorting","path":"tests/testthat/test-mutate-windowed.R","position":14,"original_position":14,"commit_id":"9411ceb73721e44003daf19730a39971f8f62d21","original_commit_id":"9411ceb73721e44003daf19730a39971f8f62d21","user":{"login":"foo-bar-baz-qux","id":7685769,"avatar_url":"https://avatars1.githubusercontent.com/u/7685769?v=4","gravatar_id":"","url":"https://api.github.com/users/foo-bar-baz-qux","html_url":"https://github.com/foo-bar-baz-qux","followers_url":"https://api.github.com/users/foo-bar-baz-qux/followers","following_url":"https://api.github.com/users/foo-bar-baz-qux/following{/other_user}","gists_url":"https://api.github.com/users/foo-bar-baz-qux/gists{/gist_id}","starred_url":"https://api.github.com/users/foo-bar-baz-qux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foo-bar-baz-qux/subscriptions","organizations_url":"https://api.github.com/users/foo-bar-baz-qux/orgs","repos_url":"https://api.github.com/users/foo-bar-baz-qux/repos","events_url":"https://api.github.com/users/foo-bar-baz-qux/events{/privacy}","received_events_url":"https://api.github.com/users/foo-bar-baz-qux/received_events","type":"User","site_admin":false},"body":"Makes sense, I'll create those additional tests in a C locale (in addition to the existing tests in the active locale).","created_at":"2017-08-23T16:49:08Z","updated_at":"2017-08-23T16:49:08Z","html_url":"https://github.com/tidyverse/dplyr/pull/2969#discussion_r134807661","pull_request_url":"https://api.github.com/repos/tidyverse/dplyr/pulls/2969","_links":{"self":{"href":"https://api.github.com/repos/tidyverse/dplyr/pulls/comments/134807661"},"html":{"href":"https://github.com/tidyverse/dplyr/pull/2969#discussion_r134807661"},"pull_request":{"href":"https://api.github.com/repos/tidyverse/dplyr/pulls/2969"}}},"pull_request":{"url":"https://api.github.com/repos/tidyverse/dplyr/pulls/2969","id":130525304,"html_url":"https://github.com/tidyverse/dplyr/pull/2969","diff_url":"https://github.com/tidyverse/dplyr/pull/2969.diff","patch_url":"https://github.com/tidyverse/dplyr/pull/2969.patch","issue_url":"https://api.github.com/repos/tidyverse/dplyr/issues/2969","number":2969,"state":"open","locked":false,"title":"Fix `row_number()` and `ntile()` to align R and C sorting","user":{"login":"foo-bar-baz-qux","id":7685769,"avatar_url":"https://avatars1.githubusercontent.com/u/7685769?v=4","gravatar_id":"","url":"https://api.github.com/users/foo-bar-baz-qux","html_url":"https://github.com/foo-bar-baz-qux","followers_url":"https://api.github.com/users/foo-bar-baz-qux/followers","following_url":"https://api.github.com/users/foo-bar-baz-qux/following{/other_user}","gists_url":"https://api.github.com/users/foo-bar-baz-qux/gists{/gist_id}","starred_url":"https://api.github.com/users/foo-bar-baz-qux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foo-bar-baz-qux/subscriptions","organizations_url":"https://api.github.com/users/foo-bar-baz-qux/orgs","repos_url":"https://api.github.com/users/foo-bar-baz-qux/repos","events_url":"https://api.github.com/users/foo-bar-baz-qux/events{/privacy}","received_events_url":"https://api.github.com/users/foo-bar-baz-qux/received_events","type":"User","site_admin":false},"body":"Fix `row_number()` and `ntile()` ordering to use the locale-dependent ordering functions in R when dealing with character vectors, rather than always using the C-locale ordering function in C (#2792).\r\n\r\nPlease see issue #2792 for in-depth analysis and discussion.\r\n\r\n### Results\r\n#### Original test case\r\n``` r\r\ndata_frame(a = c(\"a\", \"b\", \"C\")) %>% arrange(a)\r\n## # A tibble: 3 x 1\r\n##       a\r\n##   <chr>\r\n## 1     a\r\n## 2     b\r\n## 3     C\r\n\r\ndata_frame(a = c(\"a\", \"b\", \"C\")) %>% mutate(rank(a, ties.method = \"first\"))\r\n## # A tibble: 3 x 2\r\n##       a `rank(a, ties.method = \"first\")`\r\n##   <chr>                            <int>\r\n## 1     a                                1\r\n## 2     b                                2\r\n## 3     C                                3\r\n\r\ndata_frame(a = c(\"a\", \"b\", \"C\")) %>% mutate(row_number(a))\r\n## # A tibble: 3 x 2\r\n##       a `row_number(a)`\r\n##   <chr>           <int>\r\n## 1     a               1\r\n## 2     b               2\r\n## 3     C               3\r\n\r\ndata_frame(a = c(\"a\", \"b\", \"C\")) %>% mutate(dplyr::row_number(a))\r\n## # A tibble: 3 x 2\r\n##       a `dplyr::row_number(a)`\r\n##   <chr>                  <int>\r\n## 1     a                      1\r\n## 2     b                      2\r\n## 3     C                      3\r\n```\r\n\r\n#### Additional examples\r\n``` r\r\ndata_frame(a = c(\"a\", \"b\", \"C\")) %>% mutate(row_number(a))\r\n## # A tibble: 3 x 2\r\n##       a `row_number(a)`\r\n##   <chr>           <int>\r\n## 1     a               1\r\n## 2     b               2\r\n## 3     C               3\r\n\r\ndata_frame(a = c(\"[\", \"]\", \"A\", \"z\")) %>% mutate(row_number(a))\r\n## # A tibble: 4 x 2\r\n##       a `row_number(a)`\r\n##   <chr>           <int>\r\n## 1     [               1\r\n## 2     ]               2\r\n## 3     A               3\r\n## 4     z               4\r\n\r\ndata_frame(a = c(1, 22, 12, 30, 3)) %>% mutate(row_number(a))\r\n## # A tibble: 5 x 2\r\n##       a `row_number(a)`\r\n##   <dbl>           <int>\r\n## 1     1               1\r\n## 2    22               4\r\n## 3    12               3\r\n## 4    30               5\r\n## 5     3               2\r\n\r\ndata_frame(a = c(\"a\", \"C\", \"b\", \"D\"), b = c(1, 1, 2, 2)) %>% group_by(b) %>% mutate(row_number(a))\r\n## # A tibble: 4 x 3\r\n## # Groups:   b [2]\r\n##       a     b `row_number(a)`\r\n##   <chr> <dbl>           <int>\r\n## 1     a     1               1\r\n## 2     C     1               2\r\n## 3     b     2               1\r\n## 4     D     2               2\r\n\r\ndata_frame(a = c(\"a\", \"C\", \"b\", \"D\", \"E\")) %>% mutate(ntile(a, 3))\r\n## # A tibble: 5 x 2\r\n##       a `ntile(a, 3)`\r\n##   <chr>         <int>\r\n## 1     a             1\r\n## 2     C             2\r\n## 3     b             1\r\n## 4     D             2\r\n## 5     E             3\r\n\r\ndata_frame(a = c(\"[\", \"]\", NA, \"a\", \"z\")) %>% mutate(row_number(a))\r\n## # A tibble: 5 x 2\r\n##       a `row_number(a)`\r\n##   <chr>           <int>\r\n## 1     [               1\r\n## 2     ]               2\r\n## 3  <NA>              NA\r\n## 4     a               3\r\n## 5     z               4\r\n```\r\n\r\nFixes #2792.","created_at":"2017-07-14T06:40:34Z","updated_at":"2017-08-23T16:49:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f07037dcc60948fb6f03dee16b3f0fbaf932f45e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"hadley","id":4196,"avatar_url":"https://avatars3.githubusercontent.com/u/4196?v=4","gravatar_id":"","url":"https://api.github.com/users/hadley","html_url":"https://github.com/hadley","followers_url":"https://api.github.com/users/hadley/followers","following_url":"https://api.github.com/users/hadley/following{/other_user}","gists_url":"https://api.github.com/users/hadley/gists{/gist_id}","starred_url":"https://api.github.com/users/hadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadley/subscriptions","organizations_url":"https://api.github.com/users/hadley/orgs","repos_url":"https://api.github.com/users/hadley/repos","events_url":"https://api.github.com/users/hadley/events{/privacy}","received_events_url":"https://api.github.com/users/hadley/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/tidyverse/dplyr/pulls/2969/commits","review_comments_url":"https://api.github.com/repos/tidyverse/dplyr/pulls/2969/comments","review_comment_url":"https://api.github.com/repos/tidyverse/dplyr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tidyverse/dplyr/issues/2969/comments","statuses_url":"https://api.github.com/repos/tidyverse/dplyr/statuses/9411ceb73721e44003daf19730a39971f8f62d21","head":{"label":"foo-bar-baz-qux:fix_2792_submit","ref":"fix_2792_submit","sha":"9411ceb73721e44003daf19730a39971f8f62d21","user":{"login":"foo-bar-baz-qux","id":7685769,"avatar_url":"https://avatars1.githubusercontent.com/u/7685769?v=4","gravatar_id":"","url":"https://api.github.com/users/foo-bar-baz-qux","html_url":"https://github.com/foo-bar-baz-qux","followers_url":"https://api.github.com/users/foo-bar-baz-qux/followers","following_url":"https://api.github.com/users/foo-bar-baz-qux/following{/other_user}","gists_url":"https://api.github.com/users/foo-bar-baz-qux/gists{/gist_id}","starred_url":"https://api.github.com/users/foo-bar-baz-qux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foo-bar-baz-qux/subscriptions","organizations_url":"https://api.github.com/users/foo-bar-baz-qux/orgs","repos_url":"https://api.github.com/users/foo-bar-baz-qux/repos","events_url":"https://api.github.com/users/foo-bar-baz-qux/events{/privacy}","received_events_url":"https://api.github.com/users/foo-bar-baz-qux/received_events","type":"User","site_admin":false},"repo":{"id":96740987,"name":"dplyr","full_name":"foo-bar-baz-qux/dplyr","owner":{"login":"foo-bar-baz-qux","id":7685769,"avatar_url":"https://avatars1.githubusercontent.com/u/7685769?v=4","gravatar_id":"","url":"https://api.github.com/users/foo-bar-baz-qux","html_url":"https://github.com/foo-bar-baz-qux","followers_url":"https://api.github.com/users/foo-bar-baz-qux/followers","following_url":"https://api.github.com/users/foo-bar-baz-qux/following{/other_user}","gists_url":"https://api.github.com/users/foo-bar-baz-qux/gists{/gist_id}","starred_url":"https://api.github.com/users/foo-bar-baz-qux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foo-bar-baz-qux/subscriptions","organizations_url":"https://api.github.com/users/foo-bar-baz-qux/orgs","repos_url":"https://api.github.com/users/foo-bar-baz-qux/repos","events_url":"https://api.github.com/users/foo-bar-baz-qux/events{/privacy}","received_events_url":"https://api.github.com/users/foo-bar-baz-qux/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/foo-bar-baz-qux/dplyr","description":"Dplyr: A grammar of data manipulation","fork":true,"url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr","forks_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/forks","keys_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/teams","hooks_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/hooks","issue_events_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/issues/events{/number}","events_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/events","assignees_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/assignees{/user}","branches_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/branches{/branch}","tags_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/tags","blobs_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/git/refs{/sha}","trees_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/statuses/{sha}","languages_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/languages","stargazers_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/stargazers","contributors_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/contributors","subscribers_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/subscribers","subscription_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/subscription","commits_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/commits{/sha}","git_commits_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/git/commits{/sha}","comments_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/comments{/number}","issue_comment_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/issues/comments{/number}","contents_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/contents/{+path}","compare_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/merges","archive_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/downloads","issues_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/issues{/number}","pulls_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/pulls{/number}","milestones_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/milestones{/number}","notifications_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/labels{/name}","releases_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/releases{/id}","deployments_url":"https://api.github.com/repos/foo-bar-baz-qux/dplyr/deployments","created_at":"2017-07-10T05:59:20Z","updated_at":"2017-07-10T05:59:23Z","pushed_at":"2017-08-01T05:44:25Z","git_url":"git://github.com/foo-bar-baz-qux/dplyr.git","ssh_url":"git@github.com:foo-bar-baz-qux/dplyr.git","clone_url":"https://github.com/foo-bar-baz-qux/dplyr.git","svn_url":"https://github.com/foo-bar-baz-qux/dplyr","homepage":"http://dplyr.tidyverse.org","size":15003,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tidyverse:master","ref":"master","sha":"65db3212844b77ebb890c0e5f29d4e9f1f979748","user":{"login":"tidyverse","id":22032646,"avatar_url":"https://avatars2.githubusercontent.com/u/22032646?v=4","gravatar_id":"","url":"https://api.github.com/users/tidyverse","html_url":"https://github.com/tidyverse","followers_url":"https://api.github.com/users/tidyverse/followers","following_url":"https://api.github.com/users/tidyverse/following{/other_user}","gists_url":"https://api.github.com/users/tidyverse/gists{/gist_id}","starred_url":"https://api.github.com/users/tidyverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidyverse/subscriptions","organizations_url":"https://api.github.com/users/tidyverse/orgs","repos_url":"https://api.github.com/users/tidyverse/repos","events_url":"https://api.github.com/users/tidyverse/events{/privacy}","received_events_url":"https://api.github.com/users/tidyverse/received_events","type":"Organization","site_admin":false},"repo":{"id":6427813,"name":"dplyr","full_name":"tidyverse/dplyr","owner":{"login":"tidyverse","id":22032646,"avatar_url":"https://avatars2.githubusercontent.com/u/22032646?v=4","gravatar_id":"","url":"https://api.github.com/users/tidyverse","html_url":"https://github.com/tidyverse","followers_url":"https://api.github.com/users/tidyverse/followers","following_url":"https://api.github.com/users/tidyverse/following{/other_user}","gists_url":"https://api.github.com/users/tidyverse/gists{/gist_id}","starred_url":"https://api.github.com/users/tidyverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidyverse/subscriptions","organizations_url":"https://api.github.com/users/tidyverse/orgs","repos_url":"https://api.github.com/users/tidyverse/repos","events_url":"https://api.github.com/users/tidyverse/events{/privacy}","received_events_url":"https://api.github.com/users/tidyverse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tidyverse/dplyr","description":"Dplyr: A grammar of data manipulation","fork":false,"url":"https://api.github.com/repos/tidyverse/dplyr","forks_url":"https://api.github.com/repos/tidyverse/dplyr/forks","keys_url":"https://api.github.com/repos/tidyverse/dplyr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tidyverse/dplyr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tidyverse/dplyr/teams","hooks_url":"https://api.github.com/repos/tidyverse/dplyr/hooks","issue_events_url":"https://api.github.com/repos/tidyverse/dplyr/issues/events{/number}","events_url":"https://api.github.com/repos/tidyverse/dplyr/events","assignees_url":"https://api.github.com/repos/tidyverse/dplyr/assignees{/user}","branches_url":"https://api.github.com/repos/tidyverse/dplyr/branches{/branch}","tags_url":"https://api.github.com/repos/tidyverse/dplyr/tags","blobs_url":"https://api.github.com/repos/tidyverse/dplyr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tidyverse/dplyr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tidyverse/dplyr/git/refs{/sha}","trees_url":"https://api.github.com/repos/tidyverse/dplyr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tidyverse/dplyr/statuses/{sha}","languages_url":"https://api.github.com/repos/tidyverse/dplyr/languages","stargazers_url":"https://api.github.com/repos/tidyverse/dplyr/stargazers","contributors_url":"https://api.github.com/repos/tidyverse/dplyr/contributors","subscribers_url":"https://api.github.com/repos/tidyverse/dplyr/subscribers","subscription_url":"https://api.github.com/repos/tidyverse/dplyr/subscription","commits_url":"https://api.github.com/repos/tidyverse/dplyr/commits{/sha}","git_commits_url":"https://api.github.com/repos/tidyverse/dplyr/git/commits{/sha}","comments_url":"https://api.github.com/repos/tidyverse/dplyr/comments{/number}","issue_comment_url":"https://api.github.com/repos/tidyverse/dplyr/issues/comments{/number}","contents_url":"https://api.github.com/repos/tidyverse/dplyr/contents/{+path}","compare_url":"https://api.github.com/repos/tidyverse/dplyr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tidyverse/dplyr/merges","archive_url":"https://api.github.com/repos/tidyverse/dplyr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tidyverse/dplyr/downloads","issues_url":"https://api.github.com/repos/tidyverse/dplyr/issues{/number}","pulls_url":"https://api.github.com/repos/tidyverse/dplyr/pulls{/number}","milestones_url":"https://api.github.com/repos/tidyverse/dplyr/milestones{/number}","notifications_url":"https://api.github.com/repos/tidyverse/dplyr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tidyverse/dplyr/labels{/name}","releases_url":"https://api.github.com/repos/tidyverse/dplyr/releases{/id}","deployments_url":"https://api.github.com/repos/tidyverse/dplyr/deployments","created_at":"2012-10-28T13:39:17Z","updated_at":"2017-08-22T09:19:46Z","pushed_at":"2017-08-23T12:15:13Z","git_url":"git://github.com/tidyverse/dplyr.git","ssh_url":"git@github.com:tidyverse/dplyr.git","clone_url":"https://github.com/tidyverse/dplyr.git","svn_url":"https://github.com/tidyverse/dplyr","homepage":"http://dplyr.tidyverse.org","size":15416,"stargazers_count":1925,"watchers_count":1925,"language":"R","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":767,"mirror_url":null,"open_issues_count":109,"forks":767,"open_issues":109,"watchers":1925,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tidyverse/dplyr/pulls/2969"},"html":{"href":"https://github.com/tidyverse/dplyr/pull/2969"},"issue":{"href":"https://api.github.com/repos/tidyverse/dplyr/issues/2969"},"comments":{"href":"https://api.github.com/repos/tidyverse/dplyr/issues/2969/comments"},"review_comments":{"href":"https://api.github.com/repos/tidyverse/dplyr/pulls/2969/comments"},"review_comment":{"href":"https://api.github.com/repos/tidyverse/dplyr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tidyverse/dplyr/pulls/2969/commits"},"statuses":{"href":"https://api.github.com/repos/tidyverse/dplyr/statuses/9411ceb73721e44003daf19730a39971f8f62d21"}}}}
{"actor":{"display_login":"foo-bar-baz-qux"}}