[R] randomize a matrix

From: Guenther, Cameron <Cameron.Guenther_at_myfwc.com>
Date: Thu 19 Oct 2006 - 19:49:55 GMT


Hello everyone,

If I have an incidence matrix of 0 and 1's

P=[1 1 1 1 1 1

   1 1 1 1 0 0
   1 1 1 0 0 0
   1 1 1 0 0 0
   1 1 0 0 0 0]

I want to create a new uniform random matrix [a] that is filled with 0's and 1's but constrained so that the row and column sums are the same as in [P]. Does anyone know how to accomplish this?

Thanks in advance

Cameron Guenther, Ph.D.
Associate Research Scientist
FWC/FWRI, Marine Fisheries Research
100 8th Avenue S.E.
St. Petersburg, FL 33701
(727)896-8626 Ext. 4305
cameron.guenther@myfwc.com



R-help@stat.math.ethz.ch 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. Received on Fri Oct 20 05:57:53 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 20 Oct 2006 - 22:30:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.