I think the following does what you want:
probMatrix <- matrix(runif(5 * 5), 5, 5)
binomialMatrix <- matrix(rbinom(5 * 5, 1, probMatrix), 5, 5)
Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")
Economics Guy w
I am having a little trouble getting R to do something without writing
a couple of very awkward loops.
I have a matrix of probabilities and I want to generate a new matrix
of ones and zeros where each element in the new matrix is the result
of a draw from a binomial distribution where the probabil
2 matches
Mail list logo