{"action":"created","comment":{"url":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls/comments/32191175","id":32191175,"diff_hunk":"@@ -0,0 +1,69 @@\n+require(lubridate)\n+require(dplyr)\n+\n+#' Add column of time-shifted shifted metrics\n+#' \n+#' This function takes a dataframe with a date column and a metric column,\n+#' along with any other dimensions in the dataset, and creates a new\n+#' metric column time-shifted by the parameters specified. E.g. clicks for\n+#' this row one year ago or one week ago.\n+#' \n+#' @param data.in The dataframe containing a date and metric\n+#' @param date The date column in the dataframe","path":"addTimeShift_function.R","position":12,"original_position":12,"commit_id":"3eee94a716f3ca09578d7d4ca182e86968597a2a","original_commit_id":"3eee94a716f3ca09578d7d4ca182e86968597a2a","user":{"login":"echen","id":102375,"avatar_url":"https://avatars.githubusercontent.com/u/102375?v=3","gravatar_id":"","url":"https://api.github.com/users/echen","html_url":"https://github.com/echen","followers_url":"https://api.github.com/users/echen/followers","following_url":"https://api.github.com/users/echen/following{/other_user}","gists_url":"https://api.github.com/users/echen/gists{/gist_id}","starred_url":"https://api.github.com/users/echen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/echen/subscriptions","organizations_url":"https://api.github.com/users/echen/orgs","repos_url":"https://api.github.com/users/echen/repos","events_url":"https://api.github.com/users/echen/events{/privacy}","received_events_url":"https://api.github.com/users/echen/received_events","type":"User","site_admin":false},"body":"You changed your parameter names.","created_at":"2015-06-11T05:37:02Z","updated_at":"2015-06-11T05:37:02Z","html_url":"https://github.com/hudsonsuds/plotMDTS/pull/1#discussion_r32191175","pull_request_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls/comments/32191175"},"html":{"href":"https://github.com/hudsonsuds/plotMDTS/pull/1#discussion_r32191175"},"pull_request":{"href":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls/1","id":37391061,"html_url":"https://github.com/hudsonsuds/plotMDTS/pull/1","diff_url":"https://github.com/hudsonsuds/plotMDTS/pull/1.diff","patch_url":"https://github.com/hudsonsuds/plotMDTS/pull/1.patch","issue_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/issues/1","number":1,"state":"open","locked":false,"title":"Add more date functions","user":{"login":"hudsonsuds","id":5102357,"avatar_url":"https://avatars.githubusercontent.com/u/5102357?v=3","gravatar_id":"","url":"https://api.github.com/users/hudsonsuds","html_url":"https://github.com/hudsonsuds","followers_url":"https://api.github.com/users/hudsonsuds/followers","following_url":"https://api.github.com/users/hudsonsuds/following{/other_user}","gists_url":"https://api.github.com/users/hudsonsuds/gists{/gist_id}","starred_url":"https://api.github.com/users/hudsonsuds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hudsonsuds/subscriptions","organizations_url":"https://api.github.com/users/hudsonsuds/orgs","repos_url":"https://api.github.com/users/hudsonsuds/repos","events_url":"https://api.github.com/users/hudsonsuds/events{/privacy}","received_events_url":"https://api.github.com/users/hudsonsuds/received_events","type":"User","site_admin":false},"body":"This includes a few more features common w/ multi-dimensional time series analysis:\r\n\r\n## Aggregate by date\r\n```\r\nplotMDTS(example.data, metric = \"Revenue\", by.date = \"week\")\r\nplotMDTS(example.data, metric = \"Revenue\", by.date = \"month\")\r\nplotMDTS(example.data, metric = \"Revenue\", by.date = \"year\")\r\n```\r\n\r\n##  Add a Time shift\r\n```\r\nplotMDTS(example.data, metric = \"Revenue\", filter = ~date > \"2015-01-01\", time.shift = 1)\r\nplotMDTS(example.data, metric = \"Revenue\", filter = ~date > \"2015-01-01\", time.shift = 2)\r\nplotMDTS(example.data, metric = \"Revenue\", filter = ~date > \"2015-01-01\", time.shift = 2, shift.per = 30)\r\n```\r\n\r\n## Add growth rates\r\n```\r\nplotMDTS(example.data, metric = \"Revenue.growth\", filter =~date > \"2015-01-01\")\r\nplotMDTS(example.data, metric = \"Revenue.growth\", filter =~date > \"2015-01-01\", growth.per = 30)\r\n```\r\n\r\nStill pretty rough around the edges and doesn't handle dates natively (e.g. growth rates and aggregate by date don't play well together). Need to think through that a little more -- perhaps using lag isn't the best option since it's oblivious to time.","created_at":"2015-06-10T18:48:40Z","updated_at":"2015-06-11T05:37:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"256f0a900e3e0ee49338ba57f486a9c2b01a9de1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls/1/commits","review_comments_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls/1/comments","review_comment_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/issues/1/comments","statuses_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/statuses/3eee94a716f3ca09578d7d4ca182e86968597a2a","head":{"label":"hudsonsuds:Add-more-date-functions","ref":"Add-more-date-functions","sha":"3eee94a716f3ca09578d7d4ca182e86968597a2a","user":{"login":"hudsonsuds","id":5102357,"avatar_url":"https://avatars.githubusercontent.com/u/5102357?v=3","gravatar_id":"","url":"https://api.github.com/users/hudsonsuds","html_url":"https://github.com/hudsonsuds","followers_url":"https://api.github.com/users/hudsonsuds/followers","following_url":"https://api.github.com/users/hudsonsuds/following{/other_user}","gists_url":"https://api.github.com/users/hudsonsuds/gists{/gist_id}","starred_url":"https://api.github.com/users/hudsonsuds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hudsonsuds/subscriptions","organizations_url":"https://api.github.com/users/hudsonsuds/orgs","repos_url":"https://api.github.com/users/hudsonsuds/repos","events_url":"https://api.github.com/users/hudsonsuds/events{/privacy}","received_events_url":"https://api.github.com/users/hudsonsuds/received_events","type":"User","site_admin":false},"repo":{"id":36690649,"name":"plotMDTS","full_name":"hudsonsuds/plotMDTS","owner":{"login":"hudsonsuds","id":5102357,"avatar_url":"https://avatars.githubusercontent.com/u/5102357?v=3","gravatar_id":"","url":"https://api.github.com/users/hudsonsuds","html_url":"https://github.com/hudsonsuds","followers_url":"https://api.github.com/users/hudsonsuds/followers","following_url":"https://api.github.com/users/hudsonsuds/following{/other_user}","gists_url":"https://api.github.com/users/hudsonsuds/gists{/gist_id}","starred_url":"https://api.github.com/users/hudsonsuds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hudsonsuds/subscriptions","organizations_url":"https://api.github.com/users/hudsonsuds/orgs","repos_url":"https://api.github.com/users/hudsonsuds/repos","events_url":"https://api.github.com/users/hudsonsuds/events{/privacy}","received_events_url":"https://api.github.com/users/hudsonsuds/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hudsonsuds/plotMDTS","description":"A wrapper around dplyr and ggplot2 for simple/fast plotting and analysis of a multi-dimensional Time Series","fork":false,"url":"https://api.github.com/repos/hudsonsuds/plotMDTS","forks_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/forks","keys_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/teams","hooks_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/hooks","issue_events_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/issues/events{/number}","events_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/events","assignees_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/assignees{/user}","branches_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/branches{/branch}","tags_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/tags","blobs_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/git/refs{/sha}","trees_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/statuses/{sha}","languages_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/languages","stargazers_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/stargazers","contributors_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/contributors","subscribers_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/subscribers","subscription_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/subscription","commits_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/commits{/sha}","git_commits_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/git/commits{/sha}","comments_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/comments{/number}","issue_comment_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/issues/comments{/number}","contents_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/contents/{+path}","compare_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/merges","archive_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/downloads","issues_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/issues{/number}","pulls_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls{/number}","milestones_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/milestones{/number}","notifications_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/labels{/name}","releases_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/releases{/id}","created_at":"2015-06-01T21:40:58Z","updated_at":"2015-06-01T21:42:54Z","pushed_at":"2015-06-10T18:48:40Z","git_url":"git://github.com/hudsonsuds/plotMDTS.git","ssh_url":"git@github.com:hudsonsuds/plotMDTS.git","clone_url":"https://github.com/hudsonsuds/plotMDTS.git","svn_url":"https://github.com/hudsonsuds/plotMDTS","homepage":null,"size":140,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"hudsonsuds:master","ref":"master","sha":"bcac71fa8c0b0fb7bc560a97eacb9a4a296b3eff","user":{"login":"hudsonsuds","id":5102357,"avatar_url":"https://avatars.githubusercontent.com/u/5102357?v=3","gravatar_id":"","url":"https://api.github.com/users/hudsonsuds","html_url":"https://github.com/hudsonsuds","followers_url":"https://api.github.com/users/hudsonsuds/followers","following_url":"https://api.github.com/users/hudsonsuds/following{/other_user}","gists_url":"https://api.github.com/users/hudsonsuds/gists{/gist_id}","starred_url":"https://api.github.com/users/hudsonsuds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hudsonsuds/subscriptions","organizations_url":"https://api.github.com/users/hudsonsuds/orgs","repos_url":"https://api.github.com/users/hudsonsuds/repos","events_url":"https://api.github.com/users/hudsonsuds/events{/privacy}","received_events_url":"https://api.github.com/users/hudsonsuds/received_events","type":"User","site_admin":false},"repo":{"id":36690649,"name":"plotMDTS","full_name":"hudsonsuds/plotMDTS","owner":{"login":"hudsonsuds","id":5102357,"avatar_url":"https://avatars.githubusercontent.com/u/5102357?v=3","gravatar_id":"","url":"https://api.github.com/users/hudsonsuds","html_url":"https://github.com/hudsonsuds","followers_url":"https://api.github.com/users/hudsonsuds/followers","following_url":"https://api.github.com/users/hudsonsuds/following{/other_user}","gists_url":"https://api.github.com/users/hudsonsuds/gists{/gist_id}","starred_url":"https://api.github.com/users/hudsonsuds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hudsonsuds/subscriptions","organizations_url":"https://api.github.com/users/hudsonsuds/orgs","repos_url":"https://api.github.com/users/hudsonsuds/repos","events_url":"https://api.github.com/users/hudsonsuds/events{/privacy}","received_events_url":"https://api.github.com/users/hudsonsuds/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hudsonsuds/plotMDTS","description":"A wrapper around dplyr and ggplot2 for simple/fast plotting and analysis of a multi-dimensional Time Series","fork":false,"url":"https://api.github.com/repos/hudsonsuds/plotMDTS","forks_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/forks","keys_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/teams","hooks_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/hooks","issue_events_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/issues/events{/number}","events_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/events","assignees_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/assignees{/user}","branches_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/branches{/branch}","tags_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/tags","blobs_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/git/refs{/sha}","trees_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/statuses/{sha}","languages_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/languages","stargazers_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/stargazers","contributors_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/contributors","subscribers_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/subscribers","subscription_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/subscription","commits_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/commits{/sha}","git_commits_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/git/commits{/sha}","comments_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/comments{/number}","issue_comment_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/issues/comments{/number}","contents_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/contents/{+path}","compare_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/merges","archive_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/downloads","issues_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/issues{/number}","pulls_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls{/number}","milestones_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/milestones{/number}","notifications_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/labels{/name}","releases_url":"https://api.github.com/repos/hudsonsuds/plotMDTS/releases{/id}","created_at":"2015-06-01T21:40:58Z","updated_at":"2015-06-01T21:42:54Z","pushed_at":"2015-06-10T18:48:40Z","git_url":"git://github.com/hudsonsuds/plotMDTS.git","ssh_url":"git@github.com:hudsonsuds/plotMDTS.git","clone_url":"https://github.com/hudsonsuds/plotMDTS.git","svn_url":"https://github.com/hudsonsuds/plotMDTS","homepage":null,"size":140,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls/1"},"html":{"href":"https://github.com/hudsonsuds/plotMDTS/pull/1"},"issue":{"href":"https://api.github.com/repos/hudsonsuds/plotMDTS/issues/1"},"comments":{"href":"https://api.github.com/repos/hudsonsuds/plotMDTS/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hudsonsuds/plotMDTS/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/hudsonsuds/plotMDTS/statuses/3eee94a716f3ca09578d7d4ca182e86968597a2a"}}}}