#' Implements the mahad classifier evaluation
#'
#' Takes a dataframe as an argument and evaluates the performance of mahad
#' as a classifier for that dataset.
#' @author Richard D. Yentes \email{rdyentes@ncsu.edu}
#' @param x a dataframe on which to test the classifier
#' @export
mahadClassifier <- function(x, truth, cut=.5) {
md <- careless::mahad(x, plot=FALSE)
xbar <- base::mean(md)
SD <- stats::sd(md)
predictions <- ifelse(md > xbar + (SD*cut), 1, 0)
confusionMatrix(predictions,truth)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.