Re: [R] request: a class having max frequency

From: Jim Lemon <jim_at_bitwrit.com.au>
Date: Sat, 07 Jun 2008 21:38:27 +1000

Muhammad Azam wrote:
> Dear R users
> I have a very basic question. I tried but could not find the required result. using
> dat <- pima
> f <- table(dat[,9])
>
>

>>f 

>
> 0 1
> 500 268
> i want to find that class say "0" having maximum frequency i.e 500. I used
>
>>which.max(f)

>
> which provide
> 0
> 1
> How can i get only the "0". Thanks and
>
The "Mode" function in the prettyR package does this.

Jim



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 Sat 07 Jun 2008 - 11:38:22 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 Sat 07 Jun 2008 - 12:30:38 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