Here's a rather convoluted way of finding the mode (or, at least, the first mode):
x = round(rnorm(100,sd=5)) my_mode = as.numeric(names(table(x))[which.max(table(x))]) On Mon, Jan 26, 2009 at 9:28 AM, Jason Rupert <jasonkrup...@yahoo.com> wrote: > Hopefully this is a pretty simple question: > > Is there a function in R that calculates the "mode" of a sample? That is, I > would like to be able to determine the value that occurs the most frequently > in a data set. > > I tried the default R "mode" function, but it appears to provide a storage > type or something else. > > I tried the RSeek and some R documentation that I downloaded, but nothing > seems to mention calculating the "mode". > > Thanks again. > > > > > > [[alternative HTML version deleted]] > > > ______________________________________________ > 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. > > -- Mike Lawrence Graduate Student Department of Psychology Dalhousie University www.thatmike.com Looking to arrange a meeting? Check my public calendar: http://www.thatmike.com/mikes-public-calendar ~ Certainty is folly... I think. ~ ______________________________________________ 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.