[R] simple question

Carl Witthoft carl at witthoft.com
Fri Apr 23 01:49:50 CEST 2010


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



More information about the R-help mailing list