{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/pulls/comments/67033393","id":67033393,"diff_hunk":"@@ -0,0 +1,28 @@\n+import StatsBase: sample\n+\n+function sample(df::DataFrame)\n+    sample(df, 1)\n+end\n+\n+\"\"\"\n+    sample(df[, N])\n+\n+Returns a (random) sample of a DataFrame\n+\n+# Example\n+```\n+julia> using RDatasets\n+julia> iris = dataset(\"datasets\", \"iris\")\n+julia> sample(iris, 5)\n+5×5 DataFrames.DataFrame\n+│ Row │ SepalLength │ SepalWidth │ PetalLength │ PetalWidth │ Species      │\n+│ 1   │ 5.6         │ 2.9        │ 3.6         │ 1.3        │ \"versicolor\" │\n+│ 2   │ 6.4         │ 3.1        │ 5.5         │ 1.8        │ \"virginica\"  │\n+│ 3   │ 5.1         │ 3.8        │ 1.6         │ 0.2        │ \"setosa\"     │\n+│ 4   │ 5.5         │ 2.4        │ 3.7         │ 1.0        │ \"versicolor\" │\n+│ 5   │ 5.1         │ 3.8        │ 1.6         │ 0.2        │ \"setosa\"     │\n+```\n+\"\"\"\n+function sample(df::DataFrame, N::Integer)","path":"src/other/sample.jl","position":26,"original_position":26,"commit_id":"1fa1685764c89244151fad8f351c9e4d485151a8","original_commit_id":"1fa1685764c89244151fad8f351c9e4d485151a8","user":{"login":"nalimilan","id":1120448,"avatar_url":"https://avatars.githubusercontent.com/u/1120448?v=3","gravatar_id":"","url":"https://api.github.com/users/nalimilan","html_url":"https://github.com/nalimilan","followers_url":"https://api.github.com/users/nalimilan/followers","following_url":"https://api.github.com/users/nalimilan/following{/other_user}","gists_url":"https://api.github.com/users/nalimilan/gists{/gist_id}","starred_url":"https://api.github.com/users/nalimilan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nalimilan/subscriptions","organizations_url":"https://api.github.com/users/nalimilan/orgs","repos_url":"https://api.github.com/users/nalimilan/repos","events_url":"https://api.github.com/users/nalimilan/events{/privacy}","received_events_url":"https://api.github.com/users/nalimilan/received_events","type":"User","site_admin":false},"body":"Ah, and the signature should use `AbstractDataFrame`.","created_at":"2016-06-14T18:52:13Z","updated_at":"2016-06-14T18:52:13Z","html_url":"https://github.com/JuliaStats/DataFrames.jl/pull/997#discussion_r67033393","pull_request_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/pulls/997","_links":{"self":{"href":"https://api.github.com/repos/JuliaStats/DataFrames.jl/pulls/comments/67033393"},"html":{"href":"https://github.com/JuliaStats/DataFrames.jl/pull/997#discussion_r67033393"},"pull_request":{"href":"https://api.github.com/repos/JuliaStats/DataFrames.jl/pulls/997"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/pulls/997","id":73718935,"html_url":"https://github.com/JuliaStats/DataFrames.jl/pull/997","diff_url":"https://github.com/JuliaStats/DataFrames.jl/pull/997.diff","patch_url":"https://github.com/JuliaStats/DataFrames.jl/pull/997.patch","issue_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/issues/997","number":997,"state":"open","locked":false,"title":"ENH: Add sample function for DataFrames","user":{"login":"scls19fr","id":109167,"avatar_url":"https://avatars.githubusercontent.com/u/109167?v=3","gravatar_id":"","url":"https://api.github.com/users/scls19fr","html_url":"https://github.com/scls19fr","followers_url":"https://api.github.com/users/scls19fr/followers","following_url":"https://api.github.com/users/scls19fr/following{/other_user}","gists_url":"https://api.github.com/users/scls19fr/gists{/gist_id}","starred_url":"https://api.github.com/users/scls19fr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scls19fr/subscriptions","organizations_url":"https://api.github.com/users/scls19fr/orgs","repos_url":"https://api.github.com/users/scls19fr/repos","events_url":"https://api.github.com/users/scls19fr/events{/privacy}","received_events_url":"https://api.github.com/users/scls19fr/received_events","type":"User","site_admin":false},"body":"Might fix https://github.com/JuliaStats/StatsBase.jl/issues/170","created_at":"2016-06-14T10:55:37Z","updated_at":"2016-06-14T18:52:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bdaa03b029fd26208cafad3bb7eed1d747d6cf4c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/pulls/997/commits","review_comments_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/pulls/997/comments","review_comment_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/issues/997/comments","statuses_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/statuses/1fa1685764c89244151fad8f351c9e4d485151a8","head":{"label":"scls19fr:master","ref":"master","sha":"1fa1685764c89244151fad8f351c9e4d485151a8","user":{"login":"scls19fr","id":109167,"avatar_url":"https://avatars.githubusercontent.com/u/109167?v=3","gravatar_id":"","url":"https://api.github.com/users/scls19fr","html_url":"https://github.com/scls19fr","followers_url":"https://api.github.com/users/scls19fr/followers","following_url":"https://api.github.com/users/scls19fr/following{/other_user}","gists_url":"https://api.github.com/users/scls19fr/gists{/gist_id}","starred_url":"https://api.github.com/users/scls19fr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scls19fr/subscriptions","organizations_url":"https://api.github.com/users/scls19fr/orgs","repos_url":"https://api.github.com/users/scls19fr/repos","events_url":"https://api.github.com/users/scls19fr/events{/privacy}","received_events_url":"https://api.github.com/users/scls19fr/received_events","type":"User","site_admin":false},"repo":{"id":61110054,"name":"DataFrames.jl","full_name":"scls19fr/DataFrames.jl","owner":{"login":"scls19fr","id":109167,"avatar_url":"https://avatars.githubusercontent.com/u/109167?v=3","gravatar_id":"","url":"https://api.github.com/users/scls19fr","html_url":"https://github.com/scls19fr","followers_url":"https://api.github.com/users/scls19fr/followers","following_url":"https://api.github.com/users/scls19fr/following{/other_user}","gists_url":"https://api.github.com/users/scls19fr/gists{/gist_id}","starred_url":"https://api.github.com/users/scls19fr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scls19fr/subscriptions","organizations_url":"https://api.github.com/users/scls19fr/orgs","repos_url":"https://api.github.com/users/scls19fr/repos","events_url":"https://api.github.com/users/scls19fr/events{/privacy}","received_events_url":"https://api.github.com/users/scls19fr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/scls19fr/DataFrames.jl","description":"library for working with tabular data in Julia","fork":true,"url":"https://api.github.com/repos/scls19fr/DataFrames.jl","forks_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/forks","keys_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/teams","hooks_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/hooks","issue_events_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/issues/events{/number}","events_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/events","assignees_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/assignees{/user}","branches_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/branches{/branch}","tags_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/tags","blobs_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/languages","stargazers_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/stargazers","contributors_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/contributors","subscribers_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/subscribers","subscription_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/subscription","commits_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/contents/{+path}","compare_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/merges","archive_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/downloads","issues_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/issues{/number}","pulls_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/labels{/name}","releases_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/releases{/id}","deployments_url":"https://api.github.com/repos/scls19fr/DataFrames.jl/deployments","created_at":"2016-06-14T09:32:18Z","updated_at":"2016-06-14T09:32:19Z","pushed_at":"2016-06-14T10:54:21Z","git_url":"git://github.com/scls19fr/DataFrames.jl.git","ssh_url":"git@github.com:scls19fr/DataFrames.jl.git","clone_url":"https://github.com/scls19fr/DataFrames.jl.git","svn_url":"https://github.com/scls19fr/DataFrames.jl","homepage":null,"size":7699,"stargazers_count":0,"watchers_count":0,"language":"Julia","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":"JuliaStats:master","ref":"master","sha":"3400fbc81cc9d7409e288ff1319305d67f3ffec2","user":{"login":"JuliaStats","id":2761531,"avatar_url":"https://avatars.githubusercontent.com/u/2761531?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaStats","html_url":"https://github.com/JuliaStats","followers_url":"https://api.github.com/users/JuliaStats/followers","following_url":"https://api.github.com/users/JuliaStats/following{/other_user}","gists_url":"https://api.github.com/users/JuliaStats/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaStats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaStats/subscriptions","organizations_url":"https://api.github.com/users/JuliaStats/orgs","repos_url":"https://api.github.com/users/JuliaStats/repos","events_url":"https://api.github.com/users/JuliaStats/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaStats/received_events","type":"Organization","site_admin":false},"repo":{"id":4992873,"name":"DataFrames.jl","full_name":"JuliaStats/DataFrames.jl","owner":{"login":"JuliaStats","id":2761531,"avatar_url":"https://avatars.githubusercontent.com/u/2761531?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaStats","html_url":"https://github.com/JuliaStats","followers_url":"https://api.github.com/users/JuliaStats/followers","following_url":"https://api.github.com/users/JuliaStats/following{/other_user}","gists_url":"https://api.github.com/users/JuliaStats/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaStats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaStats/subscriptions","organizations_url":"https://api.github.com/users/JuliaStats/orgs","repos_url":"https://api.github.com/users/JuliaStats/repos","events_url":"https://api.github.com/users/JuliaStats/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaStats/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaStats/DataFrames.jl","description":"library for working with tabular data in Julia","fork":false,"url":"https://api.github.com/repos/JuliaStats/DataFrames.jl","forks_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/forks","keys_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/teams","hooks_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/events","assignees_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/tags","blobs_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/subscription","commits_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/merges","archive_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/downloads","issues_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/deployments","created_at":"2012-07-11T18:00:09Z","updated_at":"2016-06-09T15:04:37Z","pushed_at":"2016-06-14T10:55:37Z","git_url":"git://github.com/JuliaStats/DataFrames.jl.git","ssh_url":"git@github.com:JuliaStats/DataFrames.jl.git","clone_url":"https://github.com/JuliaStats/DataFrames.jl.git","svn_url":"https://github.com/JuliaStats/DataFrames.jl","homepage":null,"size":10573,"stargazers_count":292,"watchers_count":292,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":148,"mirror_url":null,"open_issues_count":178,"forks":148,"open_issues":178,"watchers":292,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaStats/DataFrames.jl/pulls/997"},"html":{"href":"https://github.com/JuliaStats/DataFrames.jl/pull/997"},"issue":{"href":"https://api.github.com/repos/JuliaStats/DataFrames.jl/issues/997"},"comments":{"href":"https://api.github.com/repos/JuliaStats/DataFrames.jl/issues/997/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaStats/DataFrames.jl/pulls/997/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaStats/DataFrames.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaStats/DataFrames.jl/pulls/997/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaStats/DataFrames.jl/statuses/1fa1685764c89244151fad8f351c9e4d485151a8"}}}}
{"actor":{"display_login":"nalimilan"}}