I'm doing a voting function for my predictions and I arranged the multi-class reasons into a dataframe(similar to below). However, I can't do a majority Vote on it for every row, answer is NA.
Tried to use Apply(), majorityvote()
t<-c(3,4,5,6,7,4,4,5,4)
y<-c(3,4,5,6,4,4,4,4,4)
z<-c(3,4,5,6,7,4,4,5,4)
o<-data.frame(t,y,z)
Mode <- function(x) {
ux <- unique(x)
ux[names(which.max(table(x)))]
}
apply(o, 1, Mode)