MajorityClassifier <- function(y, x){
tab <- table(y)
majority <- names(tab)[ tab == max(tab) ]
fitted <- rep(majority, nrow(x))
if(! is.null(rownames(x))) names(fitted) <- rownames(x)
result <- list(majority=majority,
fitted=fitted)
class(result) <- "MajorityClassifier"
result
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.