Re: [R] rpois formula

2009-10-07 Thread Peter Dalgaard
David Winsemius wrote:
> Or:
>  a = rpois (10, 0.1)
>  b = rpois (10, 0.15)
> 
> table(a>b, a==b, b>a)

table(sign(b-a))

comes to mind too (and table(a,b) is illuminative).


-- 
   O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

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


Re: [R] rpois formula

2009-10-07 Thread Duncan Murdoch

nedmt60 wrote:

Hi all,

It's been a while since i've used R and I can't remember how to do the
following:

i have

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

what is the code to show that a>b, b>a and a=b to show just the number of
occurances?
at the moment when I type a>b I get a nice long list of true or false.

so i'm hoping to have the following
  


> a = rpois (10, 2)
> b = rpois (10, 3)
> table(sign(a-b))

  -1 0 1
58712 16550 24738

Duncan Murdoch

a>b
  

35000


b>a
  

25000


a=b
  

4



thanks in advance



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


Re: [R] rpois formula

2009-10-06 Thread David Winsemius

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

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

And if you look at that output a bit:

table(ab, 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 (10, x)
b = rpois (10, 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.


Re: [R] rpois formula

2009-10-06 Thread Ian Fiske

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

Ian


nedmt60 wrote:
> 
> i have
> 
> a = rpois (10, x)
> b = rpois (10, y)
> 
> what is the code to show that a>b, b>a and a=b to show just the number of
> occurances?
> at the moment when I type a>b I get a nice long list of true or false.
> 

-- 
View this message in context: 
http://www.nabble.com/rpois-formula-tp25774389p25779305.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
and provide commented, minimal, self-contained, reproducible code.