Learn R Programming

bipartite (version 0.90)

sortweb: Function to sort bipartite webs

Description

This function sorts bipartite webs by either increasing/decreasing row and column totals or by a given sequence

Usage

sortweb(web, sort.order="inc", sequence=NULL)

Arguments

web
A matrix representing the interactions observed between higher trophic level species (columns) and lower trophic level species (rows). Usually this will be number of pollinators on each species of plants or number of parasitoids on each species of prey.
sort.order
sort.order can be either inc: sorted by increasing row/column totals dec: sorted by decreasing row/column totals seq: sorted by a given order, see sequence for how to specify an order
sequence
list of two with two named vectors: seq.lower and seq.higher, which specify the order in which species are sorted. To be able to sort by names obviously the given web must be a NAMED matrix, i.e. has column and row names. If you

Value

  • Returns an ordered bipartite web.

References

Vazquez, P.D., Chacoff, N.,P. and Cagnolo, L. (2009) Evaluating multiple determinants of the structure of plant-animal mutualistic networks. Ecologyin press.

See Also

For plotting and ordered web see plotweb, or visweb, .

Examples

Run this code
data(Safariland)
web <- Safariland

sortweb(Safariland, sort.order="dec") 
plotweb(sortweb(Safariland, sort.order="inc"), method="normal")   #rares species first
visweb(sortweb(Safariland,sort.order="inc"), type="diagonal", square="compartment", text="none", frame=TRUE)

# sorted by a given (here random) sequence
sequence <- list(seq.higher=sample(colnames(Safariland)), seq.lower=sample(rownames(Safariland)))
web.ordered <- sortweb(web, sort.order="seq", sequence=sequence)

Run the code above in your browser using DataLab