{"action":"created","comment":{"url":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls/comments/77447463","id":77447463,"diff_hunk":"@@ -25,20 +25,32 @@ simple_cast <- function(data, row, col, val, fun.aggregate=mean, fill=0){\n     }\n   })\n \n-  fml <- as.formula(paste(row, col, sep = \"~\"))\n-  data %>%  reshape2::acast(fml, value.var=val, fun.aggregate=fun.aggregate, fill=fill)\n+  fml <- as.formula(paste0(\"`\", row, \"`~`\", col, \"`\"))\n+  if(is.null(val)){\n+    # use sparse = TRUE and as.matrix because xtabs returns table object with occurance and it causes error in kmeans\n+    mat <- xtabs(as.formula(paste0(\"~\", \"`\", row , \"`\", \"+\", \"`\", col, \"`\")), data = data, sparse = TRUE) %>%  as.matrix()\n+    mat[mat == 0] <- fill\n+    mat\n+  }else{\n+    data %>%  reshape2::acast(fml, value.var=val, fun.aggregate=fun.aggregate, fill=fill)\n+  }\n }\n \n #' Cast data to sparse matrix by choosing row and column from a data frame\n-sparse_cast <- function(data, row, col, val=NULL, fun.aggregate=sum){\n+sparse_cast <- function(data, row, col, val=NULL, fun.aggregate=sum, count = FALSE){","path":"R/util.R","position":28,"original_position":28,"commit_id":"a29eff19be2a3bae6df082844ee66e7b1740208c","original_commit_id":"a29eff19be2a3bae6df082844ee66e7b1740208c","user":{"login":"hideaki","id":19518,"avatar_url":"https://avatars.githubusercontent.com/u/19518?v=3","gravatar_id":"","url":"https://api.github.com/users/hideaki","html_url":"https://github.com/hideaki","followers_url":"https://api.github.com/users/hideaki/followers","following_url":"https://api.github.com/users/hideaki/following{/other_user}","gists_url":"https://api.github.com/users/hideaki/gists{/gist_id}","starred_url":"https://api.github.com/users/hideaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hideaki/subscriptions","organizations_url":"https://api.github.com/users/hideaki/orgs","repos_url":"https://api.github.com/users/hideaki/repos","events_url":"https://api.github.com/users/hideaki/events{/privacy}","received_events_url":"https://api.github.com/users/hideaki/received_events","type":"User","site_admin":false},"body":"Please add some comment on what the count argument does.","created_at":"2016-09-04T06:26:35Z","updated_at":"2016-09-04T06:26:35Z","html_url":"https://github.com/exploratory-io/exploratory_func/pull/61#discussion_r77447463","pull_request_url":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls/61","_links":{"self":{"href":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls/comments/77447463"},"html":{"href":"https://github.com/exploratory-io/exploratory_func/pull/61#discussion_r77447463"},"pull_request":{"href":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls/61"}}},"pull_request":{"url":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls/61","id":83913290,"html_url":"https://github.com/exploratory-io/exploratory_func/pull/61","diff_url":"https://github.com/exploratory-io/exploratory_func/pull/61.diff","patch_url":"https://github.com/exploratory-io/exploratory_func/pull/61.patch","issue_url":"https://api.github.com/repos/exploratory-io/exploratory_func/issues/61","number":61,"state":"open","locked":false,"title":"functions update","user":{"login":"double-y","id":6638312,"avatar_url":"https://avatars.githubusercontent.com/u/6638312?v=3","gravatar_id":"","url":"https://api.github.com/users/double-y","html_url":"https://github.com/double-y","followers_url":"https://api.github.com/users/double-y/followers","following_url":"https://api.github.com/users/double-y/following{/other_user}","gists_url":"https://api.github.com/users/double-y/gists{/gist_id}","starred_url":"https://api.github.com/users/double-y/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/double-y/subscriptions","organizations_url":"https://api.github.com/users/double-y/orgs","repos_url":"https://api.github.com/users/double-y/repos","events_url":"https://api.github.com/users/double-y/events{/privacy}","received_events_url":"https://api.github.com/users/double-y/received_events","type":"User","site_admin":false},"body":"* make value column argument optional in kv functions\r\n* add score function to replace augment","created_at":"2016-09-04T04:35:45Z","updated_at":"2016-09-04T06:26:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f46ede14939b8adfc8a2698672b94a3f2f3703c3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls/61/commits","review_comments_url":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls/61/comments","review_comment_url":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls/comments{/number}","comments_url":"https://api.github.com/repos/exploratory-io/exploratory_func/issues/61/comments","statuses_url":"https://api.github.com/repos/exploratory-io/exploratory_func/statuses/a29eff19be2a3bae6df082844ee66e7b1740208c","head":{"label":"exploratory-io:yy_kv_functions_without_value","ref":"yy_kv_functions_without_value","sha":"a29eff19be2a3bae6df082844ee66e7b1740208c","user":{"login":"exploratory-io","id":17174641,"avatar_url":"https://avatars.githubusercontent.com/u/17174641?v=3","gravatar_id":"","url":"https://api.github.com/users/exploratory-io","html_url":"https://github.com/exploratory-io","followers_url":"https://api.github.com/users/exploratory-io/followers","following_url":"https://api.github.com/users/exploratory-io/following{/other_user}","gists_url":"https://api.github.com/users/exploratory-io/gists{/gist_id}","starred_url":"https://api.github.com/users/exploratory-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exploratory-io/subscriptions","organizations_url":"https://api.github.com/users/exploratory-io/orgs","repos_url":"https://api.github.com/users/exploratory-io/repos","events_url":"https://api.github.com/users/exploratory-io/events{/privacy}","received_events_url":"https://api.github.com/users/exploratory-io/received_events","type":"Organization","site_admin":false},"repo":{"id":58769613,"name":"exploratory_func","full_name":"exploratory-io/exploratory_func","owner":{"login":"exploratory-io","id":17174641,"avatar_url":"https://avatars.githubusercontent.com/u/17174641?v=3","gravatar_id":"","url":"https://api.github.com/users/exploratory-io","html_url":"https://github.com/exploratory-io","followers_url":"https://api.github.com/users/exploratory-io/followers","following_url":"https://api.github.com/users/exploratory-io/following{/other_user}","gists_url":"https://api.github.com/users/exploratory-io/gists{/gist_id}","starred_url":"https://api.github.com/users/exploratory-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exploratory-io/subscriptions","organizations_url":"https://api.github.com/users/exploratory-io/orgs","repos_url":"https://api.github.com/users/exploratory-io/repos","events_url":"https://api.github.com/users/exploratory-io/events{/privacy}","received_events_url":"https://api.github.com/users/exploratory-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/exploratory-io/exploratory_func","description":"R functions for Exploratory","fork":false,"url":"https://api.github.com/repos/exploratory-io/exploratory_func","forks_url":"https://api.github.com/repos/exploratory-io/exploratory_func/forks","keys_url":"https://api.github.com/repos/exploratory-io/exploratory_func/keys{/key_id}","collaborators_url":"https://api.github.com/repos/exploratory-io/exploratory_func/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/exploratory-io/exploratory_func/teams","hooks_url":"https://api.github.com/repos/exploratory-io/exploratory_func/hooks","issue_events_url":"https://api.github.com/repos/exploratory-io/exploratory_func/issues/events{/number}","events_url":"https://api.github.com/repos/exploratory-io/exploratory_func/events","assignees_url":"https://api.github.com/repos/exploratory-io/exploratory_func/assignees{/user}","branches_url":"https://api.github.com/repos/exploratory-io/exploratory_func/branches{/branch}","tags_url":"https://api.github.com/repos/exploratory-io/exploratory_func/tags","blobs_url":"https://api.github.com/repos/exploratory-io/exploratory_func/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/exploratory-io/exploratory_func/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/exploratory-io/exploratory_func/git/refs{/sha}","trees_url":"https://api.github.com/repos/exploratory-io/exploratory_func/git/trees{/sha}","statuses_url":"https://api.github.com/repos/exploratory-io/exploratory_func/statuses/{sha}","languages_url":"https://api.github.com/repos/exploratory-io/exploratory_func/languages","stargazers_url":"https://api.github.com/repos/exploratory-io/exploratory_func/stargazers","contributors_url":"https://api.github.com/repos/exploratory-io/exploratory_func/contributors","subscribers_url":"https://api.github.com/repos/exploratory-io/exploratory_func/subscribers","subscription_url":"https://api.github.com/repos/exploratory-io/exploratory_func/subscription","commits_url":"https://api.github.com/repos/exploratory-io/exploratory_func/commits{/sha}","git_commits_url":"https://api.github.com/repos/exploratory-io/exploratory_func/git/commits{/sha}","comments_url":"https://api.github.com/repos/exploratory-io/exploratory_func/comments{/number}","issue_comment_url":"https://api.github.com/repos/exploratory-io/exploratory_func/issues/comments{/number}","contents_url":"https://api.github.com/repos/exploratory-io/exploratory_func/contents/{+path}","compare_url":"https://api.github.com/repos/exploratory-io/exploratory_func/compare/{base}...{head}","merges_url":"https://api.github.com/repos/exploratory-io/exploratory_func/merges","archive_url":"https://api.github.com/repos/exploratory-io/exploratory_func/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/exploratory-io/exploratory_func/downloads","issues_url":"https://api.github.com/repos/exploratory-io/exploratory_func/issues{/number}","pulls_url":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls{/number}","milestones_url":"https://api.github.com/repos/exploratory-io/exploratory_func/milestones{/number}","notifications_url":"https://api.github.com/repos/exploratory-io/exploratory_func/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/exploratory-io/exploratory_func/labels{/name}","releases_url":"https://api.github.com/repos/exploratory-io/exploratory_func/releases{/id}","deployments_url":"https://api.github.com/repos/exploratory-io/exploratory_func/deployments","created_at":"2016-05-13T20:14:49Z","updated_at":"2016-08-08T10:26:38Z","pushed_at":"2016-09-04T04:35:45Z","git_url":"git://github.com/exploratory-io/exploratory_func.git","ssh_url":"git@github.com:exploratory-io/exploratory_func.git","clone_url":"https://github.com/exploratory-io/exploratory_func.git","svn_url":"https://github.com/exploratory-io/exploratory_func","homepage":null,"size":226,"stargazers_count":9,"watchers_count":9,"language":"R","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":9,"default_branch":"master"}},"base":{"label":"exploratory-io:master","ref":"master","sha":"ea71e19bffe4452d7471b576b10e7ee3c2a0077f","user":{"login":"exploratory-io","id":17174641,"avatar_url":"https://avatars.githubusercontent.com/u/17174641?v=3","gravatar_id":"","url":"https://api.github.com/users/exploratory-io","html_url":"https://github.com/exploratory-io","followers_url":"https://api.github.com/users/exploratory-io/followers","following_url":"https://api.github.com/users/exploratory-io/following{/other_user}","gists_url":"https://api.github.com/users/exploratory-io/gists{/gist_id}","starred_url":"https://api.github.com/users/exploratory-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exploratory-io/subscriptions","organizations_url":"https://api.github.com/users/exploratory-io/orgs","repos_url":"https://api.github.com/users/exploratory-io/repos","events_url":"https://api.github.com/users/exploratory-io/events{/privacy}","received_events_url":"https://api.github.com/users/exploratory-io/received_events","type":"Organization","site_admin":false},"repo":{"id":58769613,"name":"exploratory_func","full_name":"exploratory-io/exploratory_func","owner":{"login":"exploratory-io","id":17174641,"avatar_url":"https://avatars.githubusercontent.com/u/17174641?v=3","gravatar_id":"","url":"https://api.github.com/users/exploratory-io","html_url":"https://github.com/exploratory-io","followers_url":"https://api.github.com/users/exploratory-io/followers","following_url":"https://api.github.com/users/exploratory-io/following{/other_user}","gists_url":"https://api.github.com/users/exploratory-io/gists{/gist_id}","starred_url":"https://api.github.com/users/exploratory-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exploratory-io/subscriptions","organizations_url":"https://api.github.com/users/exploratory-io/orgs","repos_url":"https://api.github.com/users/exploratory-io/repos","events_url":"https://api.github.com/users/exploratory-io/events{/privacy}","received_events_url":"https://api.github.com/users/exploratory-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/exploratory-io/exploratory_func","description":"R functions for Exploratory","fork":false,"url":"https://api.github.com/repos/exploratory-io/exploratory_func","forks_url":"https://api.github.com/repos/exploratory-io/exploratory_func/forks","keys_url":"https://api.github.com/repos/exploratory-io/exploratory_func/keys{/key_id}","collaborators_url":"https://api.github.com/repos/exploratory-io/exploratory_func/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/exploratory-io/exploratory_func/teams","hooks_url":"https://api.github.com/repos/exploratory-io/exploratory_func/hooks","issue_events_url":"https://api.github.com/repos/exploratory-io/exploratory_func/issues/events{/number}","events_url":"https://api.github.com/repos/exploratory-io/exploratory_func/events","assignees_url":"https://api.github.com/repos/exploratory-io/exploratory_func/assignees{/user}","branches_url":"https://api.github.com/repos/exploratory-io/exploratory_func/branches{/branch}","tags_url":"https://api.github.com/repos/exploratory-io/exploratory_func/tags","blobs_url":"https://api.github.com/repos/exploratory-io/exploratory_func/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/exploratory-io/exploratory_func/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/exploratory-io/exploratory_func/git/refs{/sha}","trees_url":"https://api.github.com/repos/exploratory-io/exploratory_func/git/trees{/sha}","statuses_url":"https://api.github.com/repos/exploratory-io/exploratory_func/statuses/{sha}","languages_url":"https://api.github.com/repos/exploratory-io/exploratory_func/languages","stargazers_url":"https://api.github.com/repos/exploratory-io/exploratory_func/stargazers","contributors_url":"https://api.github.com/repos/exploratory-io/exploratory_func/contributors","subscribers_url":"https://api.github.com/repos/exploratory-io/exploratory_func/subscribers","subscription_url":"https://api.github.com/repos/exploratory-io/exploratory_func/subscription","commits_url":"https://api.github.com/repos/exploratory-io/exploratory_func/commits{/sha}","git_commits_url":"https://api.github.com/repos/exploratory-io/exploratory_func/git/commits{/sha}","comments_url":"https://api.github.com/repos/exploratory-io/exploratory_func/comments{/number}","issue_comment_url":"https://api.github.com/repos/exploratory-io/exploratory_func/issues/comments{/number}","contents_url":"https://api.github.com/repos/exploratory-io/exploratory_func/contents/{+path}","compare_url":"https://api.github.com/repos/exploratory-io/exploratory_func/compare/{base}...{head}","merges_url":"https://api.github.com/repos/exploratory-io/exploratory_func/merges","archive_url":"https://api.github.com/repos/exploratory-io/exploratory_func/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/exploratory-io/exploratory_func/downloads","issues_url":"https://api.github.com/repos/exploratory-io/exploratory_func/issues{/number}","pulls_url":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls{/number}","milestones_url":"https://api.github.com/repos/exploratory-io/exploratory_func/milestones{/number}","notifications_url":"https://api.github.com/repos/exploratory-io/exploratory_func/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/exploratory-io/exploratory_func/labels{/name}","releases_url":"https://api.github.com/repos/exploratory-io/exploratory_func/releases{/id}","deployments_url":"https://api.github.com/repos/exploratory-io/exploratory_func/deployments","created_at":"2016-05-13T20:14:49Z","updated_at":"2016-08-08T10:26:38Z","pushed_at":"2016-09-04T04:35:45Z","git_url":"git://github.com/exploratory-io/exploratory_func.git","ssh_url":"git@github.com:exploratory-io/exploratory_func.git","clone_url":"https://github.com/exploratory-io/exploratory_func.git","svn_url":"https://github.com/exploratory-io/exploratory_func","homepage":null,"size":226,"stargazers_count":9,"watchers_count":9,"language":"R","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls/61"},"html":{"href":"https://github.com/exploratory-io/exploratory_func/pull/61"},"issue":{"href":"https://api.github.com/repos/exploratory-io/exploratory_func/issues/61"},"comments":{"href":"https://api.github.com/repos/exploratory-io/exploratory_func/issues/61/comments"},"review_comments":{"href":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls/61/comments"},"review_comment":{"href":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/exploratory-io/exploratory_func/pulls/61/commits"},"statuses":{"href":"https://api.github.com/repos/exploratory-io/exploratory_func/statuses/a29eff19be2a3bae6df082844ee66e7b1740208c"}}}}
{"actor":{"display_login":"hideaki"}}