[R] Mode (statistics) in R?

2009-01-26 Thread Jason Rupert
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

Re: [R] Mode (statistics) in R?

2009-01-26 Thread Carlos J. Gil Bellosta
Hello, You can try ?table. Best regards, Carlos J. Gil Bellosta http://www.datanaytics.com On Mon, 2009-01-26 at 05:28 -0800, Jason Rupert 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

Re: [R] Mode (statistics) in R?

2009-01-26 Thread Mike Lawrence
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:

Re: [R] Mode (statistics) in R?

2009-01-26 Thread Jason Rupert
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 m...@thatmike.com wrote: From: Mike Lawrence m...@thatmike.com Subject: Re: [R] Mode (statistics) in R? To: jasonkrup

Re: [R] Mode (statistics) in R?

2009-01-26 Thread Marc Schwartz
on 01/26/2009 07:28 AM Jason Rupert 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

Re: [R] Mode (statistics) in R?

2009-01-26 Thread patricia garcía gonzález
Hello, I think this will work: names( sort( -table( x ) ) )[1] Regards Patricia García From: c...@datanalytics.com To: jasonkrup...@yahoo.com Date: Mon, 26 Jan 2009 18:34:00 +0500 CC: r-help@r-project.org Subject: Re: [R] Mode (statistics) in R? Hello, You can try ?table. Best