{"action":"created","comment":{"url":"https://api.github.com/repos/hadley/dplyr/pulls/comments/38099965","id":38099965,"diff_hunk":"@@ -4,14 +4,16 @@ using namespace Rcpp ;\n using namespace dplyr ;\n \n template <typename Dots>\n-List rbind__impl( Dots dots ){\n+List rbind__impl( Dots dots, SEXP id=R_NilValue ){\n     int ndata = dots.size() ;\n     int n = 0 ;\n     std::vector<DataFrameAble> chunks ;\n+    std::vector<int> df_nrows ;\n \n     for( int i=0; i<ndata; i++) {\n       chunks.push_back( DataFrameAble( dots[i] ) );\n-      n += chunks[i].nrows() ;\n+      df_nrows.push_back(chunks[i].nrows()) ;","path":"src/bind.cpp","position":14,"original_position":14,"commit_id":"f17740167182ea7eca0d6b7c8a0d06b0dd7f6661","original_commit_id":"f17740167182ea7eca0d6b7c8a0d06b0dd7f6661","user":{"login":"hadley","id":4196,"avatar_url":"https://avatars.githubusercontent.com/u/4196?v=3","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},"body":"I think this would be a little more elegant if you did `int nrows = chunks[i].nrows()`","created_at":"2015-08-27T14:19:10Z","updated_at":"2015-08-27T14:19:10Z","html_url":"https://github.com/hadley/dplyr/pull/825#discussion_r38099965","pull_request_url":"https://api.github.com/repos/hadley/dplyr/pulls/825","_links":{"self":{"href":"https://api.github.com/repos/hadley/dplyr/pulls/comments/38099965"},"html":{"href":"https://github.com/hadley/dplyr/pull/825#discussion_r38099965"},"pull_request":{"href":"https://api.github.com/repos/hadley/dplyr/pulls/825"}}},"pull_request":{"url":"https://api.github.com/repos/hadley/dplyr/pulls/825","id":25408833,"html_url":"https://github.com/hadley/dplyr/pull/825","diff_url":"https://github.com/hadley/dplyr/pull/825.diff","patch_url":"https://github.com/hadley/dplyr/pull/825.patch","issue_url":"https://api.github.com/repos/hadley/dplyr/issues/825","number":825,"state":"open","locked":false,"title":"Add .id argument to bind_rows","user":{"login":"lionel-","id":4465050,"avatar_url":"https://avatars.githubusercontent.com/u/4465050?v=3","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},"body":"This makes row_binds append an identifier column when the `.id` argument is supplied.\r\n\r\nThis is useful for the common use case of combining data frames to be used for example by ggplot2. Best used with lowliner :-)\r\n\r\n```\r\nfits <- list(lm(disp ~ cyl, mtcars), lm(disp ~ mpg, mtcars)) %>%\r\n  map(broom::tidy) %>%\r\n  bind_rows(.id = \"model\")\r\n\r\n## > + Source: local data frame [4 x 6]\r\n##\r\n##          term estimate std.error statistic    p.value      id\r\n## 1 (Intercept) -156.609   35.1805   -4.4516 1.0902e-04 model 1\r\n## 2         cyl   62.599    5.4693   11.4455 1.8028e-12 model 1\r\n## 3 (Intercept)  580.884   41.7401   13.9167 1.2634e-14 model 2\r\n## 4         mpg  -17.429    1.9925   -8.7472 9.3803e-10 model 2\r\n```","created_at":"2014-12-03T10:31:03Z","updated_at":"2015-08-27T14:19:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"26e22b9d44c5982a09782e2129c6c3062446cf46","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hadley/dplyr/pulls/825/commits","review_comments_url":"https://api.github.com/repos/hadley/dplyr/pulls/825/comments","review_comment_url":"https://api.github.com/repos/hadley/dplyr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hadley/dplyr/issues/825/comments","statuses_url":"https://api.github.com/repos/hadley/dplyr/statuses/f17740167182ea7eca0d6b7c8a0d06b0dd7f6661","head":{"label":"lionel-:master","ref":"master","sha":"f17740167182ea7eca0d6b7c8a0d06b0dd7f6661","user":{"login":"lionel-","id":4465050,"avatar_url":"https://avatars.githubusercontent.com/u/4465050?v=3","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},"repo":{"id":27480240,"name":"dplyr","full_name":"lionel-/dplyr","owner":{"login":"lionel-","id":4465050,"avatar_url":"https://avatars.githubusercontent.com/u/4465050?v=3","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},"private":false,"html_url":"https://github.com/lionel-/dplyr","description":"Plyr specialised for data frames: faster & with remote datastores","fork":true,"url":"https://api.github.com/repos/lionel-/dplyr","forks_url":"https://api.github.com/repos/lionel-/dplyr/forks","keys_url":"https://api.github.com/repos/lionel-/dplyr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lionel-/dplyr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lionel-/dplyr/teams","hooks_url":"https://api.github.com/repos/lionel-/dplyr/hooks","issue_events_url":"https://api.github.com/repos/lionel-/dplyr/issues/events{/number}","events_url":"https://api.github.com/repos/lionel-/dplyr/events","assignees_url":"https://api.github.com/repos/lionel-/dplyr/assignees{/user}","branches_url":"https://api.github.com/repos/lionel-/dplyr/branches{/branch}","tags_url":"https://api.github.com/repos/lionel-/dplyr/tags","blobs_url":"https://api.github.com/repos/lionel-/dplyr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lionel-/dplyr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lionel-/dplyr/git/refs{/sha}","trees_url":"https://api.github.com/repos/lionel-/dplyr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lionel-/dplyr/statuses/{sha}","languages_url":"https://api.github.com/repos/lionel-/dplyr/languages","stargazers_url":"https://api.github.com/repos/lionel-/dplyr/stargazers","contributors_url":"https://api.github.com/repos/lionel-/dplyr/contributors","subscribers_url":"https://api.github.com/repos/lionel-/dplyr/subscribers","subscription_url":"https://api.github.com/repos/lionel-/dplyr/subscription","commits_url":"https://api.github.com/repos/lionel-/dplyr/commits{/sha}","git_commits_url":"https://api.github.com/repos/lionel-/dplyr/git/commits{/sha}","comments_url":"https://api.github.com/repos/lionel-/dplyr/comments{/number}","issue_comment_url":"https://api.github.com/repos/lionel-/dplyr/issues/comments{/number}","contents_url":"https://api.github.com/repos/lionel-/dplyr/contents/{+path}","compare_url":"https://api.github.com/repos/lionel-/dplyr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lionel-/dplyr/merges","archive_url":"https://api.github.com/repos/lionel-/dplyr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lionel-/dplyr/downloads","issues_url":"https://api.github.com/repos/lionel-/dplyr/issues{/number}","pulls_url":"https://api.github.com/repos/lionel-/dplyr/pulls{/number}","milestones_url":"https://api.github.com/repos/lionel-/dplyr/milestones{/number}","notifications_url":"https://api.github.com/repos/lionel-/dplyr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lionel-/dplyr/labels{/name}","releases_url":"https://api.github.com/repos/lionel-/dplyr/releases{/id}","created_at":"2014-12-03T09:50:35Z","updated_at":"2015-08-27T12:15:48Z","pushed_at":"2015-08-27T13:32:04Z","git_url":"git://github.com/lionel-/dplyr.git","ssh_url":"git@github.com:lionel-/dplyr.git","clone_url":"https://github.com/lionel-/dplyr.git","svn_url":"https://github.com/lionel-/dplyr","homepage":null,"size":8720,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"hadley:master","ref":"master","sha":"07b723ce74be092c00858b3439a1402e5029608a","user":{"login":"hadley","id":4196,"avatar_url":"https://avatars.githubusercontent.com/u/4196?v=3","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},"repo":{"id":6427813,"name":"dplyr","full_name":"hadley/dplyr","owner":{"login":"hadley","id":4196,"avatar_url":"https://avatars.githubusercontent.com/u/4196?v=3","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},"private":false,"html_url":"https://github.com/hadley/dplyr","description":"Plyr specialised for data frames: faster & with remote datastores","fork":false,"url":"https://api.github.com/repos/hadley/dplyr","forks_url":"https://api.github.com/repos/hadley/dplyr/forks","keys_url":"https://api.github.com/repos/hadley/dplyr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hadley/dplyr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hadley/dplyr/teams","hooks_url":"https://api.github.com/repos/hadley/dplyr/hooks","issue_events_url":"https://api.github.com/repos/hadley/dplyr/issues/events{/number}","events_url":"https://api.github.com/repos/hadley/dplyr/events","assignees_url":"https://api.github.com/repos/hadley/dplyr/assignees{/user}","branches_url":"https://api.github.com/repos/hadley/dplyr/branches{/branch}","tags_url":"https://api.github.com/repos/hadley/dplyr/tags","blobs_url":"https://api.github.com/repos/hadley/dplyr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hadley/dplyr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hadley/dplyr/git/refs{/sha}","trees_url":"https://api.github.com/repos/hadley/dplyr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hadley/dplyr/statuses/{sha}","languages_url":"https://api.github.com/repos/hadley/dplyr/languages","stargazers_url":"https://api.github.com/repos/hadley/dplyr/stargazers","contributors_url":"https://api.github.com/repos/hadley/dplyr/contributors","subscribers_url":"https://api.github.com/repos/hadley/dplyr/subscribers","subscription_url":"https://api.github.com/repos/hadley/dplyr/subscription","commits_url":"https://api.github.com/repos/hadley/dplyr/commits{/sha}","git_commits_url":"https://api.github.com/repos/hadley/dplyr/git/commits{/sha}","comments_url":"https://api.github.com/repos/hadley/dplyr/comments{/number}","issue_comment_url":"https://api.github.com/repos/hadley/dplyr/issues/comments{/number}","contents_url":"https://api.github.com/repos/hadley/dplyr/contents/{+path}","compare_url":"https://api.github.com/repos/hadley/dplyr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hadley/dplyr/merges","archive_url":"https://api.github.com/repos/hadley/dplyr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hadley/dplyr/downloads","issues_url":"https://api.github.com/repos/hadley/dplyr/issues{/number}","pulls_url":"https://api.github.com/repos/hadley/dplyr/pulls{/number}","milestones_url":"https://api.github.com/repos/hadley/dplyr/milestones{/number}","notifications_url":"https://api.github.com/repos/hadley/dplyr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hadley/dplyr/labels{/name}","releases_url":"https://api.github.com/repos/hadley/dplyr/releases{/id}","created_at":"2012-10-28T13:39:17Z","updated_at":"2015-08-26T02:13:45Z","pushed_at":"2015-08-27T14:15:15Z","git_url":"git://github.com/hadley/dplyr.git","ssh_url":"git@github.com:hadley/dplyr.git","clone_url":"https://github.com/hadley/dplyr.git","svn_url":"https://github.com/hadley/dplyr","homepage":null,"size":15373,"stargazers_count":884,"watchers_count":884,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":351,"mirror_url":null,"open_issues_count":151,"forks":351,"open_issues":151,"watchers":884,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hadley/dplyr/pulls/825"},"html":{"href":"https://github.com/hadley/dplyr/pull/825"},"issue":{"href":"https://api.github.com/repos/hadley/dplyr/issues/825"},"comments":{"href":"https://api.github.com/repos/hadley/dplyr/issues/825/comments"},"review_comments":{"href":"https://api.github.com/repos/hadley/dplyr/pulls/825/comments"},"review_comment":{"href":"https://api.github.com/repos/hadley/dplyr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hadley/dplyr/pulls/825/commits"},"statuses":{"href":"https://api.github.com/repos/hadley/dplyr/statuses/f17740167182ea7eca0d6b7c8a0d06b0dd7f6661"}}}}