{"action":"created","comment":{"url":"https://api.github.com/repos/cloudera/spark-timeseries/pulls/comments/48065055","id":48065055,"diff_hunk":"@@ -74,9 +70,25 @@ class TimeSeriesRDD(val index: DateTimeIndex, parent: RDD[(String, Vector[Double\n     }\n   }\n \n+  def lag(maxLag: Int, includeOriginals: Boolean): TimeSeriesRDD = {\n+    val newDateTimeIndex = index.islice(maxLag, index.size)\n+\n+    val laggedTimeSeriesRDD: RDD[(String, Vector[Double])] = flatMap(t => {\n+      val tseries = new TimeSeries(index, new DenseMatrix[Double](t._2.length, 1, t._2.toArray), Array(t._1))\n+      val lag_tseries = tseries.lags(maxLag, includeOriginals)\n+      var l = List[(String, Vector[Double])]()\n+      for (c <- 0 until lag_tseries.keys.length)\n+        l ::=(lag_tseries.keys(c), lag_tseries.data(::, c).toVector)\n+      l.toIterable\n+    })\n+\n+    new TimeSeriesRDD(newDateTimeIndex, laggedTimeSeriesRDD)\n+  }\n+\n   /**\n    * Finds a series in the TimeSeriesRDD with the given key.\n    */\n+","path":"src/main/scala/com/cloudera/sparkts/TimeSeriesRDD.scala","position":61,"original_position":61,"commit_id":"1c0a0dfbe5a21b5833c4e1a754000c4d9b59d49e","original_commit_id":"1c0a0dfbe5a21b5833c4e1a754000c4d9b59d49e","user":{"login":"sryza","id":654855,"avatar_url":"https://avatars.githubusercontent.com/u/654855?v=3","gravatar_id":"","url":"https://api.github.com/users/sryza","html_url":"https://github.com/sryza","followers_url":"https://api.github.com/users/sryza/followers","following_url":"https://api.github.com/users/sryza/following{/other_user}","gists_url":"https://api.github.com/users/sryza/gists{/gist_id}","starred_url":"https://api.github.com/users/sryza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sryza/subscriptions","organizations_url":"https://api.github.com/users/sryza/orgs","repos_url":"https://api.github.com/users/sryza/repos","events_url":"https://api.github.com/users/sryza/events{/privacy}","received_events_url":"https://api.github.com/users/sryza/received_events","type":"User","site_admin":false},"body":"Unnecessary newline","created_at":"2015-12-18T20:12:58Z","updated_at":"2015-12-18T20:12:58Z","html_url":"https://github.com/cloudera/spark-timeseries/pull/89#discussion_r48065055","pull_request_url":"https://api.github.com/repos/cloudera/spark-timeseries/pulls/89","_links":{"self":{"href":"https://api.github.com/repos/cloudera/spark-timeseries/pulls/comments/48065055"},"html":{"href":"https://github.com/cloudera/spark-timeseries/pull/89#discussion_r48065055"},"pull_request":{"href":"https://api.github.com/repos/cloudera/spark-timeseries/pulls/89"}}},"pull_request":{"url":"https://api.github.com/repos/cloudera/spark-timeseries/pulls/89","id":52783397,"html_url":"https://github.com/cloudera/spark-timeseries/pull/89","diff_url":"https://github.com/cloudera/spark-timeseries/pull/89.diff","patch_url":"https://github.com/cloudera/spark-timeseries/pull/89.patch","issue_url":"https://api.github.com/repos/cloudera/spark-timeseries/issues/89","number":89,"state":"open","locked":false,"title":"Add TimeSeries RDD lag","user":{"login":"mbaddar2","id":14892802,"avatar_url":"https://avatars.githubusercontent.com/u/14892802?v=3","gravatar_id":"","url":"https://api.github.com/users/mbaddar2","html_url":"https://github.com/mbaddar2","followers_url":"https://api.github.com/users/mbaddar2/followers","following_url":"https://api.github.com/users/mbaddar2/following{/other_user}","gists_url":"https://api.github.com/users/mbaddar2/gists{/gist_id}","starred_url":"https://api.github.com/users/mbaddar2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbaddar2/subscriptions","organizations_url":"https://api.github.com/users/mbaddar2/orgs","repos_url":"https://api.github.com/users/mbaddar2/repos","events_url":"https://api.github.com/users/mbaddar2/events{/privacy}","received_events_url":"https://api.github.com/users/mbaddar2/received_events","type":"User","site_admin":false},"body":"For issue #65  I used the implementation of time series lag ","created_at":"2015-12-06T16:14:35Z","updated_at":"2015-12-18T20:12:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cloudera/spark-timeseries/pulls/89/commits","review_comments_url":"https://api.github.com/repos/cloudera/spark-timeseries/pulls/89/comments","review_comment_url":"https://api.github.com/repos/cloudera/spark-timeseries/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudera/spark-timeseries/issues/89/comments","statuses_url":"https://api.github.com/repos/cloudera/spark-timeseries/statuses/1c0a0dfbe5a21b5833c4e1a754000c4d9b59d49e","head":{"label":"mbaddar2:master","ref":"master","sha":"1c0a0dfbe5a21b5833c4e1a754000c4d9b59d49e","user":{"login":"mbaddar2","id":14892802,"avatar_url":"https://avatars.githubusercontent.com/u/14892802?v=3","gravatar_id":"","url":"https://api.github.com/users/mbaddar2","html_url":"https://github.com/mbaddar2","followers_url":"https://api.github.com/users/mbaddar2/followers","following_url":"https://api.github.com/users/mbaddar2/following{/other_user}","gists_url":"https://api.github.com/users/mbaddar2/gists{/gist_id}","starred_url":"https://api.github.com/users/mbaddar2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbaddar2/subscriptions","organizations_url":"https://api.github.com/users/mbaddar2/orgs","repos_url":"https://api.github.com/users/mbaddar2/repos","events_url":"https://api.github.com/users/mbaddar2/events{/privacy}","received_events_url":"https://api.github.com/users/mbaddar2/received_events","type":"User","site_admin":false},"repo":{"id":43378406,"name":"spark-timeseries","full_name":"mbaddar2/spark-timeseries","owner":{"login":"mbaddar2","id":14892802,"avatar_url":"https://avatars.githubusercontent.com/u/14892802?v=3","gravatar_id":"","url":"https://api.github.com/users/mbaddar2","html_url":"https://github.com/mbaddar2","followers_url":"https://api.github.com/users/mbaddar2/followers","following_url":"https://api.github.com/users/mbaddar2/following{/other_user}","gists_url":"https://api.github.com/users/mbaddar2/gists{/gist_id}","starred_url":"https://api.github.com/users/mbaddar2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbaddar2/subscriptions","organizations_url":"https://api.github.com/users/mbaddar2/orgs","repos_url":"https://api.github.com/users/mbaddar2/repos","events_url":"https://api.github.com/users/mbaddar2/events{/privacy}","received_events_url":"https://api.github.com/users/mbaddar2/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mbaddar2/spark-timeseries","description":"A library for financial and time series calculations on Apache Spark","fork":true,"url":"https://api.github.com/repos/mbaddar2/spark-timeseries","forks_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/forks","keys_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/teams","hooks_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/hooks","issue_events_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/issues/events{/number}","events_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/events","assignees_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/assignees{/user}","branches_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/branches{/branch}","tags_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/tags","blobs_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/git/refs{/sha}","trees_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/statuses/{sha}","languages_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/languages","stargazers_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/stargazers","contributors_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/contributors","subscribers_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/subscribers","subscription_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/subscription","commits_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/commits{/sha}","git_commits_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/git/commits{/sha}","comments_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/comments{/number}","issue_comment_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/issues/comments{/number}","contents_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/contents/{+path}","compare_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/merges","archive_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/downloads","issues_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/issues{/number}","pulls_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/pulls{/number}","milestones_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/milestones{/number}","notifications_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/labels{/name}","releases_url":"https://api.github.com/repos/mbaddar2/spark-timeseries/releases{/id}","created_at":"2015-09-29T16:04:52Z","updated_at":"2015-09-29T16:04:53Z","pushed_at":"2015-12-17T11:59:44Z","git_url":"git://github.com/mbaddar2/spark-timeseries.git","ssh_url":"git@github.com:mbaddar2/spark-timeseries.git","clone_url":"https://github.com/mbaddar2/spark-timeseries.git","svn_url":"https://github.com/mbaddar2/spark-timeseries","homepage":null,"size":1107,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cloudera:master","ref":"master","sha":"55baf24ea561ae73780f812e59288b6484fc756c","user":{"login":"cloudera","id":87383,"avatar_url":"https://avatars.githubusercontent.com/u/87383?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudera","html_url":"https://github.com/cloudera","followers_url":"https://api.github.com/users/cloudera/followers","following_url":"https://api.github.com/users/cloudera/following{/other_user}","gists_url":"https://api.github.com/users/cloudera/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudera/subscriptions","organizations_url":"https://api.github.com/users/cloudera/orgs","repos_url":"https://api.github.com/users/cloudera/repos","events_url":"https://api.github.com/users/cloudera/events{/privacy}","received_events_url":"https://api.github.com/users/cloudera/received_events","type":"Organization","site_admin":false},"repo":{"id":32005904,"name":"spark-timeseries","full_name":"cloudera/spark-timeseries","owner":{"login":"cloudera","id":87383,"avatar_url":"https://avatars.githubusercontent.com/u/87383?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudera","html_url":"https://github.com/cloudera","followers_url":"https://api.github.com/users/cloudera/followers","following_url":"https://api.github.com/users/cloudera/following{/other_user}","gists_url":"https://api.github.com/users/cloudera/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudera/subscriptions","organizations_url":"https://api.github.com/users/cloudera/orgs","repos_url":"https://api.github.com/users/cloudera/repos","events_url":"https://api.github.com/users/cloudera/events{/privacy}","received_events_url":"https://api.github.com/users/cloudera/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudera/spark-timeseries","description":"A library for financial and time series calculations on Apache Spark","fork":false,"url":"https://api.github.com/repos/cloudera/spark-timeseries","forks_url":"https://api.github.com/repos/cloudera/spark-timeseries/forks","keys_url":"https://api.github.com/repos/cloudera/spark-timeseries/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudera/spark-timeseries/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudera/spark-timeseries/teams","hooks_url":"https://api.github.com/repos/cloudera/spark-timeseries/hooks","issue_events_url":"https://api.github.com/repos/cloudera/spark-timeseries/issues/events{/number}","events_url":"https://api.github.com/repos/cloudera/spark-timeseries/events","assignees_url":"https://api.github.com/repos/cloudera/spark-timeseries/assignees{/user}","branches_url":"https://api.github.com/repos/cloudera/spark-timeseries/branches{/branch}","tags_url":"https://api.github.com/repos/cloudera/spark-timeseries/tags","blobs_url":"https://api.github.com/repos/cloudera/spark-timeseries/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudera/spark-timeseries/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudera/spark-timeseries/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudera/spark-timeseries/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudera/spark-timeseries/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudera/spark-timeseries/languages","stargazers_url":"https://api.github.com/repos/cloudera/spark-timeseries/stargazers","contributors_url":"https://api.github.com/repos/cloudera/spark-timeseries/contributors","subscribers_url":"https://api.github.com/repos/cloudera/spark-timeseries/subscribers","subscription_url":"https://api.github.com/repos/cloudera/spark-timeseries/subscription","commits_url":"https://api.github.com/repos/cloudera/spark-timeseries/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudera/spark-timeseries/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudera/spark-timeseries/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudera/spark-timeseries/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudera/spark-timeseries/contents/{+path}","compare_url":"https://api.github.com/repos/cloudera/spark-timeseries/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudera/spark-timeseries/merges","archive_url":"https://api.github.com/repos/cloudera/spark-timeseries/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudera/spark-timeseries/downloads","issues_url":"https://api.github.com/repos/cloudera/spark-timeseries/issues{/number}","pulls_url":"https://api.github.com/repos/cloudera/spark-timeseries/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudera/spark-timeseries/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudera/spark-timeseries/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudera/spark-timeseries/labels{/name}","releases_url":"https://api.github.com/repos/cloudera/spark-timeseries/releases{/id}","created_at":"2015-03-11T08:14:49Z","updated_at":"2015-12-18T19:57:42Z","pushed_at":"2015-12-17T11:59:44Z","git_url":"git://github.com/cloudera/spark-timeseries.git","ssh_url":"git@github.com:cloudera/spark-timeseries.git","clone_url":"https://github.com/cloudera/spark-timeseries.git","svn_url":"https://github.com/cloudera/spark-timeseries","homepage":null,"size":1804,"stargazers_count":327,"watchers_count":327,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":110,"mirror_url":null,"open_issues_count":45,"forks":110,"open_issues":45,"watchers":327,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudera/spark-timeseries/pulls/89"},"html":{"href":"https://github.com/cloudera/spark-timeseries/pull/89"},"issue":{"href":"https://api.github.com/repos/cloudera/spark-timeseries/issues/89"},"comments":{"href":"https://api.github.com/repos/cloudera/spark-timeseries/issues/89/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudera/spark-timeseries/pulls/89/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudera/spark-timeseries/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudera/spark-timeseries/pulls/89/commits"},"statuses":{"href":"https://api.github.com/repos/cloudera/spark-timeseries/statuses/1c0a0dfbe5a21b5833c4e1a754000c4d9b59d49e"}}}}