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)
        }

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to