[R] permutations of a binary matrix with fixed margins

Mathieu Jérôme jerome.mathieu at snv.jussieu.fr
Thu Apr 5 15:34:01 CEST 2007


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
10
01
and change it for
01
10
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
Jerome

-- 
Jérôme Mathieu
Laboratory of soil tropical ecology
UPMC
jerome.mathieu at snv.jussieu.fr



More information about the R-help mailing list