Or:
 a = rpois (100000, 0.1)
 b = rpois (100000, 0.15)

table(a>b, a==b, b>a)

And if you look at that output a bit:

table(a<b,a==b )[c(1,3,2)]  # for a>b, b>a and a=b .
# 79049 12712  8239   .. since FALSE < TRUE
--

On Oct 6, 2009, at 9:49 PM, Ian Fiske wrote:


try
sum(a > b)
sum(b > a)
sum(a == b)

Ian


nedmt60 wrote:

i have

a = rpois (100000, x)
b = rpois (100000, y)

what is the code to show that a>b, b>a and a=b to show just the number of
occurances?

occurrences?

at the moment when I type a>b I get a nice long list of true or false.

As you _should_ when you supply two vectors to a binary operator.



--


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to