# NOT RUN {
obs <- networklevel(Safariland, index="generality")
nulls <- decimalr2dtable(10, Safariland)
g.dec <- sapply(nulls, networklevel, index="generality")
nullsint <- nullmodel(Safariland, N=10)
g.int <- sapply(nullsint, networklevel, index="generality")
plot(density(g.dec[1,]), xlim=c(1, 3))
lines(density(g.int[1,]), col="red")
abline(v=obs[1], col="green")
## If you want to use external abundances to set up your null model:
set.seed(1)
ext.rows <- runif(9) # imagine these are your external abundances for Safariland
ext.cols <- runif(27)
# standardise to sum = 1:
ext.rows <- ext.rows/sum(ext.rows)
ext.cols <- ext.rows/sum(ext.cols)
web <- tcrossprod(ext.rows, ext.cols) * sum(Safariland)
# (to get to the same interaction density as original web)
#
# this can now be used as input for decimalr2dtable:
image(decimalr2dtable(N=1, web)[[1]]) # remember: white are high values!
# }
Run the code above in your browser using DataLab