Thanks. 
 
I ended up breaking it up into two steps:
 
table_data<-table(data)
subset(table_data, table_data==max(table_data))
 
Thanks again.


--- On Mon, 1/26/09, Mike Lawrence <[email protected]> wrote:

From: Mike Lawrence <[email protected]>
Subject: Re: [R] Mode (statistics) in R?
To: [email protected]
Cc: [email protected]
Date: Monday, January 26, 2009, 7:39 AM

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 <[email protected]>
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]]
>
>
> ______________________________________________
> [email protected] 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. ~



      
        [[alternative HTML version deleted]]

______________________________________________
[email protected] 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