Re: [R] Histograms with strings,

From: David Wolfskill <r_at_catwhisker.org>
Date: Thu, 17 Mar 2011 16:42:17 -0700

On Thu, Mar 17, 2011 at 10:06:21PM +0000, Khanvilkar, Shashank 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?
> ...

Does this come close?

> tmpInFile <- read.csv("X")
> tmpInFile

   Nr V2

1   1 74.125.224.38
2   2 74.125.224.38
3   3  129.46.71.19
4   4  129.46.71.19
5   5  129.46.71.19
6   6  129.46.71.19
7   7  129.46.71.19
8   8  129.46.71.19
9   9  129.46.71.19
10 10  129.46.71.19
11 11  129.46.71.19
12 12  129.46.71.19

> table(tmpInFile$V2)

 129.46.71.19 74.125.224.38

           10 2
>

Peace,
david

-- 
David H. Wolfskill				r_at_catwhisker.org
Depriving a girl or boy of an opportunity for education is evil.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.

______________________________________________ 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.

  • application/pgp-signature attachment: stored
Received on Fri 18 Mar 2011 - 00:36: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 Fri 18 Mar 2011 - 01:00:22 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