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
.)
hope this helps. spencer graves
Michael R. Allen wrote:
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
Dear R People:
Is there a function to find the mode of a data set, please?
This is the mode as in the value(s) which occur most often.
Thanks so much!
R for Windows, v 1.7.0
Sincerely,
Erin Hodgess
mailto: [EMAIL PROTECTED]
__
[EMAIL PROTECTED]
On Monday 23 June 2003 17:50, Erin Hodgess wrote:
Dear R People:
Is there a function to find the mode of a data set, please?
This is the mode as in the value(s) which occur most often.
x[rev(order(table(x)))[1]]
is this what you want?
regards
Adelchi Azzalini
--
Adelchi Azzalini
Dear Erin,
Assuming that by data set you mean a vector v, then
sort(table(v))
will give you what you want.
On Mon, 23 Jun 2003, Erin Hodgess wrote:
Date: Mon, 23 Jun 2003 10:50:47 -0500 (CDT)
From: Erin Hodgess [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [R] mode of a data set
Dear