use table and count all occurances at one time
> X
[1] 1 1 1 1 1 1 3 1 2 1 1 1 1 1 1 1 1 3 2 1 1 4 1 1 1 1 1 5 1
1> table(X)
X
1 2 3 4 5
24 2 2 1 1>
On Sat, Mar 20, 2010 at 3:43 AM, tj <girlme80@yahoo.com> wrote:
>
> Hi, may I ask for your help...
> What is the R code if I want to count the number of times that
"2" appeared
> in the following R output
>
> > k
> [1] 1 1 1 1 1 1 3 1 2 1 1 1 1 1 1 1 1 3 2 1 1 4 1 1 1 1 1 5 1 1
>
>
>
>
> Thank you for your help. :-)
> --
> View this message in context:
>
http://n4.nabble.com/How-to-count-the-number-of-occurence-tp1661733p1661733.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
[[alternative HTML version deleted]]