[R] Factor Variable frequency

ruipbarradas at sapo.pt ruipbarradas at sapo.pt
Tue May 24 18:29:46 CEST 2016


Hello,

Maybe the following (untested).

table(df$Protocol[df$Speed == "SLOW"])

Hope this helps,

Rui Barradas
 

Citando ch.elahe via R-help <r-help at r-project.org>:

> Hi all,
> I have the following df:
>
>    $ Protocol       : Factor w/ 48 levels "DP FS QTSE SAG",..: 2 3  
> 43 42 31 36 37 30 28 5 ...
>
>    $ Speed         : chr  "SLOW" "SLOW" "SLOW" "VerySLOW" ...
> How can I get the most frequent Protocol when Speed is "SLOW"?
> Thanks for any help!
> Elahe
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide  
> http://www.R-project.org/posting-guide.htmland provide commented,  
> minimal, self-contained, reproducible code.

 

	[[alternative HTML version deleted]]



More information about the R-help mailing list