[R] request: a class having max frequency

Daniel Folkinshteyn dfolkins at gmail.com
Fri Jun 6 15:25:44 CEST 2008


names(f)[which.max(f)]

on 06/06/2008 09:14 AM Muhammad Azam said the following:
> 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 
> 
> 
> best regards
> 
> Muhammad Azam 
> Ph.D. Student 
> Department of Medical Statistics, 
> Informatics and Health Economics 
> University of Innsbruck, Austria 
> 
> 
>       
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.
>



More information about the R-help mailing list