[R] mode of a data set

Michael R. Allen mallen at tntech.edu
Fri Feb 11 22:47:11 CET 2005


I was looking up how to find the mode of a data set in R and found some 
solutions through your service.  But,  I needed a program to find the 
mode or modes of a data set.  Here is what I came up with:

names(sort(table(x)))[sort(table(x))==max(sort(table(x)))]

Michael Allen
Department of Mathematics
Tennessee Technological University
Cookeville, TN 38505
USA




More information about the R-help mailing list