[R] Histograms with strings,

jim holtman jholtman at gmail.com
Fri Mar 18 00:39:14 CET 2011


try this:

> x
 [1] "74.125.224.38" "74.125.224.38" "129.46.71.19"  "129.46.71.19"
"129.46.71.19"  "129.46.71.19"
 [7] "129.46.71.19"  "129.46.71.19"  "129.46.71.19"  "129.46.71.19"
"129.46.71.19"  "129.46.71.19"
> table(x)
x
 129.46.71.19 74.125.224.38
           10             2
> which.max(table(x))
129.46.71.19
           1


On Thu, Mar 17, 2011 at 6:06 PM, Khanvilkar, Shashank
<skhanvil at qualcomm.com> wrote:
> Hello,
> Thanks in advance for any help,
>
> I have read a CSV file in which there is a column for an IP addr as in:
>
> tmpInFile$V2
>  [1] "74.125.224.38" "74.125.224.38" "129.46.71.19"  "129.46.71.19"
>  [5] "129.46.71.19"  "129.46.71.19"  "129.46.71.19"  "129.46.71.19"
>  [9] "129.46.71.19"  "129.46.71.19"  "129.46.71.19"  "129.46.71.19"
>
> If I want to find the IP addr that has the highest occurrence (129.46.71.19, in this case), is there a simple way to do this?
>
> Thanks
> Shank
>
>        [[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.
>



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?



More information about the R-help mailing list