[R] mode or parameters of readBin

2007-09-10 Thread Sigbert Klinke
Hi, sapply(formals(readBin), mode) con what n sizesignedendian namename numeric logical logicalcall returns for the mode of size logical. But in the documentation is said that size should be integer. Does anyone know why the mode is logical? Thanks

Re: [R] mode or parameters of readBin

2007-09-10 Thread Duncan Murdoch
On 9/10/2007 10:26 AM, Sigbert Klinke wrote: Hi, sapply(formals(readBin), mode) con what n sizesignedendian namename numeric logical logicalcall returns for the mode of size logical. But in the documentation is said that size should be

Re: [R] mode or parameters of readBin

2007-09-10 Thread Thomas Lumley
On Mon, 10 Sep 2007, Sigbert Klinke wrote: Hi, sapply(formals(readBin), mode) con what n sizesignedendian namename numeric logical logicalcall returns for the mode of size logical. But in the documentation is said that size should be integer. Does

Re: [R] mode of a data set

2005-02-11 Thread Michael R. Allen
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 of

Re: [R] mode of a data set

2005-02-11 Thread Spencer Graves
That'll work, provided x is discrete or categorical. Otherwise, the mode is not a well defined concept, as has been discussed on this list several times. I just got 17 hits for a search - R site search - finding the mode of a distribution from data from www.r-project.org. The

[R] Mode?

2004-11-23 Thread LONG Yu
Dear all, I want to find out the mode for a data set, anyone knows how to do it in R? I tried the codes below, but it seems too long: tt-table(data1) #get the frequency tables of data1 oo-order(tt);#get the order of frequencies len-length(tt) #the length of the

Re: [R] Mode?

2004-11-23 Thread Uwe Ligges
LONG Yu wrote: Dear all, I want to find out the mode for a data set, anyone knows how to do it in R? I tried the codes below, but it seems too long: tt-table(data1) #get the frequency tables of data1 oo-order(tt);#get the order of frequencies len-length(tt) #the

Re: [R] Mode?

2004-11-23 Thread Dimitris Rizopoulos
: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: LONG Yu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 23, 2004 9:19 AM Subject: [R] Mode? Dear all, I want

Re: [R] Mode?

2004-11-23 Thread francoisromain
Yhe question of finding the mode of a dataset has been discussed previously in the list not only for categorical data : search How can I get the mode in the search engine of the list. Hope this helps. Romain. Selon Uwe Ligges [EMAIL PROTECTED]: LONG Yu wrote: Dear all, I want to find

[R] Mode in case of discrete or categorial data

2004-11-12 Thread Vito Ricci
Thanking John for his suggestion I build this function which get the mode of both categorial and discrete data. Mode-function(x){t-table(x) if (is.numeric(x)) as.numeric(names(t)[t == max(t)]) else (names(t)[t == max(t)]) } Any other improvement and suggestion will welcome. Best Vito s [1]

RE: [R] Mode in case of discrete or categorial data

2004-11-12 Thread Liaw, Andy
You might want to do a bit to handle NAs, as table() excludes them by default. Also, you could write it a bit cleaner as: Mode - function(x) { tab - table(x) m - names(tab)[tab == max(tab)] if (is.numeric(x)) m - as.numeric(m) m } (Generally I try avoiding constructs like: if

RE: [R] Mode in case of discrete or categorial data

2004-11-12 Thread Prof Brian Ripley
On Fri, 12 Nov 2004, Liaw, Andy wrote: You might want to do a bit to handle NAs, as table() excludes them by default. Also, you could write it a bit cleaner as: Mode - function(x) { tab - table(x) m - names(tab)[tab == max(tab)] if (is.numeric(x)) m - as.numeric(m) m } (Generally I

Re: [R] Mode in case of discrete or categorial data

2004-11-12 Thread Thomas Lumley
On Fri, 12 Nov 2004, Vito Ricci wrote: Mode-function(x){t-table(x) if (is.numeric(x)) as.numeric(names(t)[t == max(t)]) else (names(t)[t == max(t)]) } Any other improvement and suggestion will welcome. which.max is design for finding the maximum, so names(t)[which.max(t)] -thomas

RE: [R] Mode in case of discrete or categorial data

2004-11-12 Thread John Fox
-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thomas Lumley Sent: Friday, November 12, 2004 10:44 AM To: Vito Ricci Cc: [EMAIL PROTECTED] Subject: Re: [R] Mode in case

RE: [R] Mode in case of discrete or categorial data

2004-11-12 Thread Liaw, Andy
From: Thomas Lumley On Fri, 12 Nov 2004, Vito Ricci wrote: Mode-function(x){t-table(x) if (is.numeric(x)) as.numeric(names(t)[t == max(t)]) else (names(t)[t == max(t)]) } Any other improvement and suggestion will welcome. which.max is design for finding the maximum, so

RE: [R] mode of a distribution - was (no subject)

2004-08-24 Thread Charles Annis, P.E.
Perhaps a time out might be helpful. ?which.max will produce the location (index) of the maximum of a numeric vector, but Paolo doesn't want that. He wants the location of the most frequent observation which would be the maximum of the probability density, which he doesn't have. It would be

Re: [R] mode

2003-12-13 Thread Ted Harding
Douglas Bates wrote: Christian Mora [EMAIL PROTECTED] writes: How can I get the mode (most frequent value) from a dataset (continuos variables)? I can obtain it when the data is discrete (by making a table and looking at the higher frequency) but I don't know how obtain it from, for example, a

Re: [R] mode

2003-12-13 Thread Ted Harding
Sorry, typo: On 13-Dec-03 Ted Harding wrote: Example of kernel density estimation: X-c(rnorm(200),2+0.5*rnorm(300)) hist(X,freq=FALSE,breaks=(-4)+0.2*(0:50)) S-density(X,from=(-4),to=5,bw=0.2) N-length(S$y) V1-S$y[1:(N-2)];V2-S$y[2:(N-1)];V3-S$y[3:N] ix-1+which((V1V2)(V2V3))

Re: [R] mode

2003-12-12 Thread Murray Jorgensen
Apologies for pursuing this increasingly off-topic thread, but I've just remembered that 'my' mode is not so hard to compute. Suppose a one-dimensional data set is in general position (all gaps unequal), find the smallest gap, then choose whichever endpoint has the closest neighbour. That's the

[R] mode

2003-12-11 Thread Christian Mora
How can I get the mode (most frequent value) from a dataset (continuos variables)? I can obtain it when the data is discrete (by making a table and looking at the higher frequency) but I don't know how obtain it from, for example, a density plot of the data. Does anyone know how to do it? Thanks

Re: [R] mode

2003-12-11 Thread Douglas Bates
Christian Mora [EMAIL PROTECTED] writes: How can I get the mode (most frequent value) from a dataset (continuos variables)? I can obtain it when the data is discrete (by making a table and looking at the higher frequency) but I don't know how obtain it from, for example, a density plot of the

Re: [R] mode

2003-12-11 Thread Murray Jorgensen
The mode of a data vector x might be defined as the limit of m_p as p tends to zero from above and where m_p is the m minimizing sum(abs(x - m)). I would not expect the mode so defined to be of much use in data analysis, nor would it be easy to compute. Murray Douglas Bates wrote: Christian

Re: [R] mode

2003-12-11 Thread Murray Jorgensen
Opps! This is what I should have written: The mode of a data vector x might be defined as the limit of m_p as p tends to zero from above and where m_p is the m minimizing sum(abs(x - m)^p). I would not expect the mode so defined to be of much use in data analysis, nor would it be easy to

Re: [R] mode

2003-12-11 Thread Prof Brian Ripley
On 11 Dec 2003, Douglas Bates wrote: Christian Mora [EMAIL PROTECTED] writes: How can I get the mode (most frequent value) from a dataset (continuos variables)? I can obtain it when the data is discrete (by making a table and looking at the higher frequency) but I don't know how obtain

[R] mode of a data set

2003-06-23 Thread Erin Hodgess
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]

Re: [R] mode of a data set

2003-06-23 Thread Adelchi Azzalini
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

Re: [R] mode of a data set

2003-06-23 Thread J.R. Lockwood
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

Re: [R] Mode of MCMC chain

2003-06-05 Thread Thomas W Blackwell
Patrik - I interpret your question as statistical mode rather than storage mode, etc. and I ask you to think about whether this question is even well-defined. Statistical mode, in the sense of the most frequent value, is well-defined for samples from a distribution on a discrete set, and it is

[R] Mode of MCMC chain

2003-06-04 Thread Patrik Waldmann
Hello, are there any functions in R for estimation of the mode of a MCMC-chain? Best, Patrik Waldmann [[alternate HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help