Description Usage Arguments Details Value Author(s) Examples
RandomLinks.
1 2 |
links |
a list of |
S |
the number of species in the pool from which ‘links’ were drawn |
matrices |
a |
PMOfLinks
converts the ‘list of links’ form to 'predation
matrix' form, a square matrix with ‘S’ rows and ‘S’ columns.
Either a list
of square matrices
or a list
of
matrices
with columns named ‘resource’ and ‘consumer’.
Lawrence Hudson
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Generate some links
links <- RandomLinks(n=10, S=10, C=0.15)
links[[1]]
# Get predation matrices
pm <- PMOfLinks(links, 10)
pm[[1]]
# Get lists of links
reconstructed.links <- LinksOfPM(pm)
# Randomly generated links will have an arbitraty order - order by consumer,
# resource for the purposes of comparison
links <- lapply(links, function(l) l[order(l[,'consumer'], l[,'resource']),])
# Should be TRUE
all.equal(links, reconstructed.links)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.