Or use this handy-dandy function: smode<-function(x){ xtab<-table(x) modes<-xtab[max(xtab)==xtab] mag<-as.numeric(modes[1]) #in case mult. modes, this is safer themodes<-names(modes) mout<-list(themodes=themodes,modeval=mag) return(mout) }