{"action":"created","issue":{"url":"https://api.github.com/repos/topepo/caret/issues/178","labels_url":"https://api.github.com/repos/topepo/caret/issues/178/labels{/name}","comments_url":"https://api.github.com/repos/topepo/caret/issues/178/comments","events_url":"https://api.github.com/repos/topepo/caret/issues/178/events","html_url":"https://github.com/topepo/caret/pull/178","id":93282458,"number":178,"title":"added lfda model for initial pull request","user":{"login":"terrytangyuan","id":4269898,"avatar_url":"https://avatars.githubusercontent.com/u/4269898?v=3","gravatar_id":"","url":"https://api.github.com/users/terrytangyuan","html_url":"https://github.com/terrytangyuan","followers_url":"https://api.github.com/users/terrytangyuan/followers","following_url":"https://api.github.com/users/terrytangyuan/following{/other_user}","gists_url":"https://api.github.com/users/terrytangyuan/gists{/gist_id}","starred_url":"https://api.github.com/users/terrytangyuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terrytangyuan/subscriptions","organizations_url":"https://api.github.com/users/terrytangyuan/orgs","repos_url":"https://api.github.com/users/terrytangyuan/repos","events_url":"https://api.github.com/users/terrytangyuan/events{/privacy}","received_events_url":"https://api.github.com/users/terrytangyuan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-06T13:47:28Z","updated_at":"2015-07-17T18:19:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/topepo/caret/pulls/178","html_url":"https://github.com/topepo/caret/pull/178","diff_url":"https://github.com/topepo/caret/pull/178.diff","patch_url":"https://github.com/topepo/caret/pull/178.patch"},"body":"Hi Max, \r\n\r\nCould you please take a look at this pull request for addition of Local Fisher Discriminant Analysis Model (LFDA)? I haven't done any testing with the caret package yet. I am not familiar with the structure of caret so feel free to put the code into wherever appropriate for you. \r\n\r\nThanks,\r\nYuan"},"comment":{"url":"https://api.github.com/repos/topepo/caret/issues/comments/122364022","html_url":"https://github.com/topepo/caret/pull/178#issuecomment-122364022","issue_url":"https://api.github.com/repos/topepo/caret/issues/178","id":122364022,"user":{"login":"topepo","id":5731043,"avatar_url":"https://avatars.githubusercontent.com/u/5731043?v=3","gravatar_id":"","url":"https://api.github.com/users/topepo","html_url":"https://github.com/topepo","followers_url":"https://api.github.com/users/topepo/followers","following_url":"https://api.github.com/users/topepo/following{/other_user}","gists_url":"https://api.github.com/users/topepo/gists{/gist_id}","starred_url":"https://api.github.com/users/topepo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/topepo/subscriptions","organizations_url":"https://api.github.com/users/topepo/orgs","repos_url":"https://api.github.com/users/topepo/repos","events_url":"https://api.github.com/users/topepo/events{/privacy}","received_events_url":"https://api.github.com/users/topepo/received_events","type":"User","site_admin":false},"created_at":"2015-07-17T18:19:01Z","updated_at":"2015-07-17T18:19:01Z","body":"Previously, you had a functional called `lfda` that called another function internal to that one (which I think had the same name). My suggestion was to make a class called `lfda`. You need the general function (see below) and then one called `lfda.default` [1]. I suggested taking the internal function that does the computations and defining that externally. You don't want to give it the same name, so I suggested `lfda_calc`. \r\n\r\nYou might want something like this:\r\n\r\n```r\r\n\"lfda\" <- function(x, ...) UseMethod(\"lfda\")\r\n\"lfda.default\" <- \r\n  function(x, y, r = 3, metric = c(\"orthonormalized\",\"plain\",\"weighted\"),knn = 5, ...)\r\n  {\r\n    if(is.data.frame(x)) x <- as.matrix(x)\r\n    \r\n    metric <- match.arg(metric)\r\n    modelArgs <- c(list(x,y,r,metric,knn))\r\n    out <- do.call(\"lfda_calc\", modelArgs)\r\n\r\n<snip>\r\n```\r\n\r\nIt also might help to read this reference a bit [2]\r\n\r\n[1] and probably another called `lfda.formula` but we can do that later\r\n[2] [Advanced R](http://adv-r.had.co.nz/). See the section on \"OO-essentials\""}}