[R] permutations of a binary matrix with fixed margins

From: Mathieu Jérôme <jerome.mathieu_at_snv.jussieu.fr>
Date: Thu 05 Apr 2007 - 13:34:01 GMT

Dear R Users,
How can I randomize a matrix (with contains only 0 and 1) with the constraint that margin totals (columns and rows sums) are kept constant? Some have called this "swap permutation" or something like that.

The principle is to find bloc of
and change it for
there can be several rows or columns between these numbers. It probably exists in R, but I can't find the function. I am aware of permcont, but it works only for 2x2 matrices

thanks in advance

Jérôme Mathieu
Laboratory of soil tropical ecology

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu Apr 05 23:46:10 2007

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 Thu 05 Apr 2007 - 14:30:48 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.