Function: mode
By tholscla on Sat, 11/02/2013 - 19:29This calculates the mode of a vector (like mean() and median()). Finds the most common element in a vector.
mode=function(vector_name)
{ as.numeric(names(sort(table(vector_name),decreasing=TRUE))[1]) }