Re: [R] calculating the mode in R...

From: Rainer M Krug <r.m.krug_at_gmail.com>
Date: Wed, 30 Mar 2011 10:26:26 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 30/03/11 02:47, Fernando Marmolejo Ramos wrote:
> Dear R users
>
> I?m aware that the package ?modest? is useful to find the mode in an array.
>
> However, I?d like to know if someone has translated the ?mode? function built-in
> in MATLAB into R language. This function finds the most frequent value in an
> array (http://www.mathworks.com/help/techdoc/ref/mode.html).

This sounds like a combination of the table() which tabulates your data, and the max() function to identify the max - but then you have to specify what to do when two values have the same count.

Rainer

>
> Best
>
> Fer
>
> ______________________________________________
> R-help_at_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.

Centre of Excellence for Invasion Biology Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      Rainer_at_krugs.de

Skype:      RMkrug

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2S6TIACgkQoYgNqgF2ego48ACdHfCL+BdGA6wZ4bHrjq2wCXJW vIoAnREiHFeSbJy9vYQPEnRhpV6nLbNB
=suk2
-----END PGP SIGNATURE-----



R-help_at_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. Received on Wed 30 Mar 2011 - 08:33:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 Mar 2011 - 09:20:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive