Learn R Programming

backbone (version 2.0.0)

curveball: Randomize a binary matrix using the curveball algorithm

Description

curveball randomizes a binary matrix, preserving the row and column sums

Usage

curveball(M)

Arguments

M

matrix: a binary matrix

Value

matrix: A random binary matrix with same row sums and column sums as M.

References

Strona, Giovanni, Domenico Nappo, Francesco Boccacci, Simone Fattorini, and Jesus San-Miguel-Ayanz. 2014. A Fast and Unbiased Procedure to Randomize Ecological Binary Matrices with Fixed Row and Column Totals. Nature Communications, 5, 4114. 10.1038/ncomms5114

Examples

Run this code
# NOT RUN {
B <- matrix(rbinom(200,1,0.5),10,20)  #A random bipartite graph
curveball(B)
# }

Run the code above in your browser using DataLab