{"action":"created","comment":{"url":"https://api.github.com/repos/jhollist/lakemorpho/pulls/comments/93465602","pull_request_review_id":13992357,"id":93465602,"diff_hunk":"@@ -0,0 +1,61 @@\n+#' Calculate the length of the minor axis for lake\n+#' \n+#' Minor axis length is defined as the minimum length spanning the convex hull\n+#' of a lake.\n+#' \n+#' @param inLakeMorpho An object of \\code{\\link{lakeMorphoClass}}.  Output of the \n+#'        \\code{\\link{lakeSurroundTopo}} function would be appropriate as input\n+#' @param pointDens Number of points to place equidistant along shoreline. The \n+#'        maximum point to point distance that does not also intersect the \n+#'        shoreline is used.  To total of n*(n-1)/2 comparisons is possible, but\n+#'        in practice is usually significant less.\n+#' @param addLine Boolean to determine if the selected minor axis line should be \n+#'        added to the inLakeMorpho object.  Defaults to True\n+#' \n+#' @export\n+#' @return This returns a numeric value indicating the length of the minor axis\n+#'  in the lake. Units are the same as the input data.\n+#' \n+#' @references \\href{https://en.wikipedia.org/wiki/Semi-major_and_semi-minor_axes}{Link}\n+#' @import sp rgeos methods\n+#' @importFrom sp spsample\n+#' @importFrom stats dist\n+#' @importFrom cluster ellipsoidhull\n+#' @examples\n+#' data(lakes)\n+#' lakeMinorAxisLength(inputLM, 50)\n+#' lines(inputLM$minoraxisLengthLine)\n+\n+lakeMinorAxisLength <- function(inLakeMorpho, pointDens, addLine = TRUE) {\n+  if (class(inLakeMorpho) != \"lakeMorpho\") {\n+    stop(\"Input data is not of class 'lakeMorpho'.  Run lakeSurround Topo or lakeMorphoClass first.\")\n+  }\n+  \n+  result <- NA\n+  lakeShorePoints <- spsample(as(inLakeMorpho$lake, \"SpatialLines\"), pointDens, \"regular\")@coords\n+  # chull <- gConvexHull(lakeShorePoints)\n+  \n+  # https://stackoverflow.com/questions/18278382/how-to-obtain-the-lengths-of-semi-axes-of-an-ellipse-in-r\n+  elpshull <- predict(cluster::ellipsoidhull(lakeShorePoints))\n+  elpshull.center <- matrix(colMeans((elpshull)), ncol = 2, nrow = 1)\n+  \n+  dist2center <- sqrt(rowSums((t(t(elpshull) - colMeans((elpshull))))^2))\n+  # max(dist2center)     ## major axis\n+  # min(dist2center)   ## minor axis\n+\n+  myLine.min <- rbind(elpshull.center, elpshull[dist2center == min(dist2center),])\n+  \n+  myLine <- SpatialLines(list(Lines(list(Line(myLine.min)), \"1\")),\n+              proj4string = CRS(proj4string(inLakeMorpho$lake)))\n+\n+  result <- max(dist2center)","path":"R/lakeMinorAxisLength.R","position":51,"original_position":51,"commit_id":"17fd7be4988659ed1b59296301f9573c6b88f745","original_commit_id":"17fd7be4988659ed1b59296301f9573c6b88f745","user":{"login":"jhollist","id":5438539,"avatar_url":"https://avatars.githubusercontent.com/u/5438539?v=3","gravatar_id":"","url":"https://api.github.com/users/jhollist","html_url":"https://github.com/jhollist","followers_url":"https://api.github.com/users/jhollist/followers","following_url":"https://api.github.com/users/jhollist/following{/other_user}","gists_url":"https://api.github.com/users/jhollist/gists{/gist_id}","starred_url":"https://api.github.com/users/jhollist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhollist/subscriptions","organizations_url":"https://api.github.com/users/jhollist/orgs","repos_url":"https://api.github.com/users/jhollist/repos","events_url":"https://api.github.com/users/jhollist/events{/privacy}","received_events_url":"https://api.github.com/users/jhollist/received_events","type":"User","site_admin":false},"body":"should this be min(dist2center)??  ","created_at":"2016-12-21T16:01:24Z","updated_at":"2016-12-21T16:26:28Z","html_url":"https://github.com/jhollist/lakemorpho/pull/5#discussion_r93465602","pull_request_url":"https://api.github.com/repos/jhollist/lakemorpho/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/jhollist/lakemorpho/pulls/comments/93465602"},"html":{"href":"https://github.com/jhollist/lakemorpho/pull/5#discussion_r93465602"},"pull_request":{"href":"https://api.github.com/repos/jhollist/lakemorpho/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/jhollist/lakemorpho/pulls/5","id":98865040,"html_url":"https://github.com/jhollist/lakemorpho/pull/5","diff_url":"https://github.com/jhollist/lakemorpho/pull/5.diff","patch_url":"https://github.com/jhollist/lakemorpho/pull/5.patch","issue_url":"https://api.github.com/repos/jhollist/lakemorpho/issues/5","number":5,"state":"open","locked":false,"title":"Add major/minor axis length and ratio","user":{"login":"jsta","id":7844578,"avatar_url":"https://avatars.githubusercontent.com/u/7844578?v=3","gravatar_id":"","url":"https://api.github.com/users/jsta","html_url":"https://github.com/jsta","followers_url":"https://api.github.com/users/jsta/followers","following_url":"https://api.github.com/users/jsta/following{/other_user}","gists_url":"https://api.github.com/users/jsta/gists{/gist_id}","starred_url":"https://api.github.com/users/jsta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsta/subscriptions","organizations_url":"https://api.github.com/users/jsta/orgs","repos_url":"https://api.github.com/users/jsta/repos","events_url":"https://api.github.com/users/jsta/events{/privacy}","received_events_url":"https://api.github.com/users/jsta/received_events","type":"User","site_admin":false},"body":"See #4 ","created_at":"2016-12-21T03:13:09Z","updated_at":"2016-12-21T16:26:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5676b80675cd7535441db45dcf48f27f3dc70566","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/jhollist/lakemorpho/pulls/5/commits","review_comments_url":"https://api.github.com/repos/jhollist/lakemorpho/pulls/5/comments","review_comment_url":"https://api.github.com/repos/jhollist/lakemorpho/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jhollist/lakemorpho/issues/5/comments","statuses_url":"https://api.github.com/repos/jhollist/lakemorpho/statuses/17fd7be4988659ed1b59296301f9573c6b88f745","head":{"label":"jsta:master","ref":"master","sha":"17fd7be4988659ed1b59296301f9573c6b88f745","user":{"login":"jsta","id":7844578,"avatar_url":"https://avatars.githubusercontent.com/u/7844578?v=3","gravatar_id":"","url":"https://api.github.com/users/jsta","html_url":"https://github.com/jsta","followers_url":"https://api.github.com/users/jsta/followers","following_url":"https://api.github.com/users/jsta/following{/other_user}","gists_url":"https://api.github.com/users/jsta/gists{/gist_id}","starred_url":"https://api.github.com/users/jsta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsta/subscriptions","organizations_url":"https://api.github.com/users/jsta/orgs","repos_url":"https://api.github.com/users/jsta/repos","events_url":"https://api.github.com/users/jsta/events{/privacy}","received_events_url":"https://api.github.com/users/jsta/received_events","type":"User","site_admin":false},"repo":{"id":70721821,"name":"lakemorpho","full_name":"jsta/lakemorpho","owner":{"login":"jsta","id":7844578,"avatar_url":"https://avatars.githubusercontent.com/u/7844578?v=3","gravatar_id":"","url":"https://api.github.com/users/jsta","html_url":"https://github.com/jsta","followers_url":"https://api.github.com/users/jsta/followers","following_url":"https://api.github.com/users/jsta/following{/other_user}","gists_url":"https://api.github.com/users/jsta/gists{/gist_id}","starred_url":"https://api.github.com/users/jsta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsta/subscriptions","organizations_url":"https://api.github.com/users/jsta/orgs","repos_url":"https://api.github.com/users/jsta/repos","events_url":"https://api.github.com/users/jsta/events{/privacy}","received_events_url":"https://api.github.com/users/jsta/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jsta/lakemorpho","description":null,"fork":true,"url":"https://api.github.com/repos/jsta/lakemorpho","forks_url":"https://api.github.com/repos/jsta/lakemorpho/forks","keys_url":"https://api.github.com/repos/jsta/lakemorpho/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jsta/lakemorpho/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jsta/lakemorpho/teams","hooks_url":"https://api.github.com/repos/jsta/lakemorpho/hooks","issue_events_url":"https://api.github.com/repos/jsta/lakemorpho/issues/events{/number}","events_url":"https://api.github.com/repos/jsta/lakemorpho/events","assignees_url":"https://api.github.com/repos/jsta/lakemorpho/assignees{/user}","branches_url":"https://api.github.com/repos/jsta/lakemorpho/branches{/branch}","tags_url":"https://api.github.com/repos/jsta/lakemorpho/tags","blobs_url":"https://api.github.com/repos/jsta/lakemorpho/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jsta/lakemorpho/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jsta/lakemorpho/git/refs{/sha}","trees_url":"https://api.github.com/repos/jsta/lakemorpho/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jsta/lakemorpho/statuses/{sha}","languages_url":"https://api.github.com/repos/jsta/lakemorpho/languages","stargazers_url":"https://api.github.com/repos/jsta/lakemorpho/stargazers","contributors_url":"https://api.github.com/repos/jsta/lakemorpho/contributors","subscribers_url":"https://api.github.com/repos/jsta/lakemorpho/subscribers","subscription_url":"https://api.github.com/repos/jsta/lakemorpho/subscription","commits_url":"https://api.github.com/repos/jsta/lakemorpho/commits{/sha}","git_commits_url":"https://api.github.com/repos/jsta/lakemorpho/git/commits{/sha}","comments_url":"https://api.github.com/repos/jsta/lakemorpho/comments{/number}","issue_comment_url":"https://api.github.com/repos/jsta/lakemorpho/issues/comments{/number}","contents_url":"https://api.github.com/repos/jsta/lakemorpho/contents/{+path}","compare_url":"https://api.github.com/repos/jsta/lakemorpho/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jsta/lakemorpho/merges","archive_url":"https://api.github.com/repos/jsta/lakemorpho/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jsta/lakemorpho/downloads","issues_url":"https://api.github.com/repos/jsta/lakemorpho/issues{/number}","pulls_url":"https://api.github.com/repos/jsta/lakemorpho/pulls{/number}","milestones_url":"https://api.github.com/repos/jsta/lakemorpho/milestones{/number}","notifications_url":"https://api.github.com/repos/jsta/lakemorpho/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jsta/lakemorpho/labels{/name}","releases_url":"https://api.github.com/repos/jsta/lakemorpho/releases{/id}","deployments_url":"https://api.github.com/repos/jsta/lakemorpho/deployments","created_at":"2016-10-12T17:01:20Z","updated_at":"2016-10-12T17:01:22Z","pushed_at":"2016-12-21T03:10:18Z","git_url":"git://github.com/jsta/lakemorpho.git","ssh_url":"git@github.com:jsta/lakemorpho.git","clone_url":"https://github.com/jsta/lakemorpho.git","svn_url":"https://github.com/jsta/lakemorpho","homepage":null,"size":1781,"stargazers_count":0,"watchers_count":0,"language":"R","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":"jhollist:master","ref":"master","sha":"d84efcb84d7218659d41b936a3b036cd316f7943","user":{"login":"jhollist","id":5438539,"avatar_url":"https://avatars.githubusercontent.com/u/5438539?v=3","gravatar_id":"","url":"https://api.github.com/users/jhollist","html_url":"https://github.com/jhollist","followers_url":"https://api.github.com/users/jhollist/followers","following_url":"https://api.github.com/users/jhollist/following{/other_user}","gists_url":"https://api.github.com/users/jhollist/gists{/gist_id}","starred_url":"https://api.github.com/users/jhollist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhollist/subscriptions","organizations_url":"https://api.github.com/users/jhollist/orgs","repos_url":"https://api.github.com/users/jhollist/repos","events_url":"https://api.github.com/users/jhollist/events{/privacy}","received_events_url":"https://api.github.com/users/jhollist/received_events","type":"User","site_admin":false},"repo":{"id":58568296,"name":"lakemorpho","full_name":"jhollist/lakemorpho","owner":{"login":"jhollist","id":5438539,"avatar_url":"https://avatars.githubusercontent.com/u/5438539?v=3","gravatar_id":"","url":"https://api.github.com/users/jhollist","html_url":"https://github.com/jhollist","followers_url":"https://api.github.com/users/jhollist/followers","following_url":"https://api.github.com/users/jhollist/following{/other_user}","gists_url":"https://api.github.com/users/jhollist/gists{/gist_id}","starred_url":"https://api.github.com/users/jhollist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhollist/subscriptions","organizations_url":"https://api.github.com/users/jhollist/orgs","repos_url":"https://api.github.com/users/jhollist/repos","events_url":"https://api.github.com/users/jhollist/events{/privacy}","received_events_url":"https://api.github.com/users/jhollist/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jhollist/lakemorpho","description":null,"fork":false,"url":"https://api.github.com/repos/jhollist/lakemorpho","forks_url":"https://api.github.com/repos/jhollist/lakemorpho/forks","keys_url":"https://api.github.com/repos/jhollist/lakemorpho/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jhollist/lakemorpho/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jhollist/lakemorpho/teams","hooks_url":"https://api.github.com/repos/jhollist/lakemorpho/hooks","issue_events_url":"https://api.github.com/repos/jhollist/lakemorpho/issues/events{/number}","events_url":"https://api.github.com/repos/jhollist/lakemorpho/events","assignees_url":"https://api.github.com/repos/jhollist/lakemorpho/assignees{/user}","branches_url":"https://api.github.com/repos/jhollist/lakemorpho/branches{/branch}","tags_url":"https://api.github.com/repos/jhollist/lakemorpho/tags","blobs_url":"https://api.github.com/repos/jhollist/lakemorpho/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jhollist/lakemorpho/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jhollist/lakemorpho/git/refs{/sha}","trees_url":"https://api.github.com/repos/jhollist/lakemorpho/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jhollist/lakemorpho/statuses/{sha}","languages_url":"https://api.github.com/repos/jhollist/lakemorpho/languages","stargazers_url":"https://api.github.com/repos/jhollist/lakemorpho/stargazers","contributors_url":"https://api.github.com/repos/jhollist/lakemorpho/contributors","subscribers_url":"https://api.github.com/repos/jhollist/lakemorpho/subscribers","subscription_url":"https://api.github.com/repos/jhollist/lakemorpho/subscription","commits_url":"https://api.github.com/repos/jhollist/lakemorpho/commits{/sha}","git_commits_url":"https://api.github.com/repos/jhollist/lakemorpho/git/commits{/sha}","comments_url":"https://api.github.com/repos/jhollist/lakemorpho/comments{/number}","issue_comment_url":"https://api.github.com/repos/jhollist/lakemorpho/issues/comments{/number}","contents_url":"https://api.github.com/repos/jhollist/lakemorpho/contents/{+path}","compare_url":"https://api.github.com/repos/jhollist/lakemorpho/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jhollist/lakemorpho/merges","archive_url":"https://api.github.com/repos/jhollist/lakemorpho/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jhollist/lakemorpho/downloads","issues_url":"https://api.github.com/repos/jhollist/lakemorpho/issues{/number}","pulls_url":"https://api.github.com/repos/jhollist/lakemorpho/pulls{/number}","milestones_url":"https://api.github.com/repos/jhollist/lakemorpho/milestones{/number}","notifications_url":"https://api.github.com/repos/jhollist/lakemorpho/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jhollist/lakemorpho/labels{/name}","releases_url":"https://api.github.com/repos/jhollist/lakemorpho/releases{/id}","deployments_url":"https://api.github.com/repos/jhollist/lakemorpho/deployments","created_at":"2016-05-11T17:59:00Z","updated_at":"2016-11-10T19:36:54Z","pushed_at":"2016-12-21T03:13:10Z","git_url":"git://github.com/jhollist/lakemorpho.git","ssh_url":"git@github.com:jhollist/lakemorpho.git","clone_url":"https://github.com/jhollist/lakemorpho.git","svn_url":"https://github.com/jhollist/lakemorpho","homepage":null,"size":1770,"stargazers_count":4,"watchers_count":4,"language":"R","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":4,"forks":2,"open_issues":4,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jhollist/lakemorpho/pulls/5"},"html":{"href":"https://github.com/jhollist/lakemorpho/pull/5"},"issue":{"href":"https://api.github.com/repos/jhollist/lakemorpho/issues/5"},"comments":{"href":"https://api.github.com/repos/jhollist/lakemorpho/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/jhollist/lakemorpho/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/jhollist/lakemorpho/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jhollist/lakemorpho/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/jhollist/lakemorpho/statuses/17fd7be4988659ed1b59296301f9573c6b88f745"}}}}
{"actor":{"display_login":"jhollist"}}