Hi

I have two vectors, prob and size, and I want to add the random deviates 
  of these two, i.e.

sum(
   sapply(
          1:length(prob),
          function(n){ rbinom(1, size(n), prob(n) }
         )
)

My problem is that I have to do this for a large number of value 
combinations. Is there a faster way of doing this?

Rainer

______________________________________________
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