Displaying 1 result from an estimated 1 matches for "tempbinmat".
2008 Jul 18
0
spreading the risk
.... Hi ACroske: The code below takes a zeros and ones matrix and
puts ones
in the places you wanted. It can be made shorter ( maybe ?. i haven't
thought about that ) but first let me know if that's what you wanted ?
The original matrix is called binary.matrix and the final matrix is
called tempbinmat. it should work for any size matrix but i didn't check
for speed so it might be slow if the original matrix is large.
# CREATE PROBABILITY MATRIX
prob.matrix<-matrix(runif(36,0,0.5),ncol=6)
#print(prob.matrix)
# CREATE BINARY MATRIX BASED ON PROB MATRIX
binary.matrix<-matrix(rbinom(l...