Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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="dec", 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 want to order an unnamed web, you can either order it by row/column totals are you have to simply specify the sequence as follows (example puts last row/column to the front): web[c(9, 1:8), c(27, 1:26)]

Value

Returns an ordered bipartite web.

Author(s)

Bernd Gruber

References

Vázquez, P.D., Chacoff, N.,P. and Cagnolo, L. (2009) Evaluating multiple determinants of the structure of plant-animal mutualistic networks. Ecology in press.

See Also

For plotting and ordered web see plotweb, method="normal" or visweb, type="none".

Examples

data(Safariland)
web <- Safariland

sortweb(Safariland, sort.order="dec") 
#rarest species first:
plotweb(sortweb(Safariland, sort.order="inc"), method="normal")   
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)

bipartite

Visualising Bipartite Networks and Calculating Some (Ecological) Indices

v2.16
GPL
Authors
Carsten F. Dormann, Jochen Fruend and Bernd Gruber, with additional code from Stephen Beckett, Mariano Devoto, Gabriel Felix, Jose Iriondo, Tove Opsahl, Rafael Pinheiro, Rouven Strauss and Diego Vazquez, also based on C-code developed by Nils Bluethgen, Aaron Clauset/Rouven Strauss and Miguel Rodriguez-Girones
Initial release
2021-02-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.