inst/classify.R

classify <- function(testData, meansList, invCovsList) {
  n <- ncol(testData)
  df <- testData %>% adply(.margins = 1, .fun = function(x) {
    Mahalanobis(x, meansList = meansList, invCovsList = invCovsList)
  })
  Guess_df <- df[,(n+1):ncol(df)] %>% adply(.margins = 1, .fun = classifiedName)
  Guess <- Guess_df[ncol(Guess_df)]
  names(Guess) <- "Class Guess"
  Guess
}
BenBarnard/slidR documentation built on Jan. 2, 2018, 4:32 p.m.