Calculates a variety of indices and values for each group of a bipartite network (one.grouplevel
is the actual function to do the computations and is not intended to be called by the user)
1 2 3 
web 
Web is 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 host. 
index 
One or more of the following (exact match only!):

level 
For which of the two groups (“levels”) should these indices be computed? Options are lower, higher and both (default). Although 
weighted 
logical; for those indices which are simply averaged across species to yield the grouplevel index (e.g. niche overlap), should this averaging take into account the number of observations for a species? Defaults to 
empty.web 
Shall the empty columns and rows be deleted? Defaults to TRUE. 
dist 
Distance metric to be used to calculate niche overlap (calling 
CCfun 
Method to use when calculating the clustering coefficient. Originally proposed as mean of cluster coefficients for each node. Defaults to median, because cluster coefficients are strongly skewed. 
logbase 
Shall various indices (partner diversity, generality/vulnerability) be calculated to the base of e (default) or 2? Log2 is the proposal for generality and vulnerability by Bersier et al. (2002), while Shannon uses ln. The choice of the base will not affect the results qualitatively, at most by a scaling factor. 
normalise 
Logical; shall the Cscore and togetherness metrics be normalised to a range of 0 to 1? Defaults to 
extinctmethod 
Specifies how species are removed from matrix: random or abundance (partial matching), where abundance removes species in the order of increasing abundance (i.e. rarest first); see Memmott et al. (2004). 
nrep 
Number of replicates for the extinction sequence analysis. 
fcweighted 
Logical; when computing "functional complementarity" sensu function 
fcdist 
Distance measure to be used to compute functional complementarity through 
This function implements a variety of the many (and still procreating) indices describing network topography at the group level.
Note that Bersier et al. (2002) have three levels of values for some of their indices: qualitative (i.e. based on binary networks), quantitative (based on networks with information on the number of interactions observed for each link), and weightedquantitative (where each species is given a weight according to the number of interactions it has). At present, we implement a mixture of qualitative, quantitative and weightedquantitative indices and offer the option weighted to compute the weightedquantitative version of some of them (mean number of links, mean number of shared partners, cluster coefficient, partner diversity, generality / vulnerability). For all others, the mechanics behind the index do not allow a weighted mean to be computed (e.g. the distancematrix between all species combinations used to compute niche.overlap).
All indices in this function work with real as well as integer values.
Extinction slope works on a repeated random sequence of species extinctions (within one trophic level), and calculates the number of secondary extinctions (in the other level). These values are then averaged (over the nrep runs) and plotted against the number of species exterminated. The proportion still recent (on the yaxis) regressed against the proportion exterminated (on the xaxis) is hence standardised to values between 0 and 1 each. Through this plot, a hyperbolic regression is fitted, and the slope of this regression line is returned as an index of extinction sensitivity. The larger the slope, the later the extinction takes its toll on the other trophic level, and hence the higher the redundancy in the trophic level under consideration. Using plot.it=F also returns the graphs (set history to recording in the plotting window). Changing the extinctionmethod to “abundance” will always result in the same sequence (by increasing abundance) and hence does not require replication.
Most indices are straightforward, oneline formulae; some, such as betweenness, also require a rearranging of the matrix; and one, secondary extinction slope, internally requires iterative runs, making the function relatively slow. If you are not interested in the secondary extinction slopes, simply set nrep=1 to make it much faster.
The suffixes LL and HL refer to lower and higher level, respectively. If values for both levels are requested, those for the higher level are given first, followed immediately by those for the lower level.
Depending on the selected indices, some or all of the below (returned as vector if “degree distribution” was not requested, otherwise as list):
mean number of species 
sic, possibly weighted (if weighted=TRUE; the weighted mean is not something typically reported, but it seems a very plausible way to embrace the uncertainty introduced by species with very few interactions). 
mean number of links 
sic (sum of links for each species, averaged over all species in that level), possibly weighted (if weighted=TRUE). 
mean number of shared partners 
Based on the distance matrix between species, counting the number of species in the other level that both interact with; based on Roberts & Stone (1990) and Stone & Roberts (1992), i.e. for pollinators will yield mean number of plants shared by any two pollinators (Cannot be weighted.) 
cluster coefficient 
The cluster coefficient for a level is the (weighted) average cluster coefficients of its members. The cluster coefficient for each species, in turn, is simply the number of realised links divided by the number of possible links. Introduced by Watts & Strogatz (1998) and described in Wikipedia under http://en.wikipedia.org/w/index.php?title=Clustering_coefficient. If you want to use Tore Opsahl's adaptation to twomodes, please see the next index, based on his function 
weighted cluster coefficient 
When asking for “weighted cluster coefficient”, this version will automatically use interactions as weights unless the data are binary. The computation is based on 
niche overlap 
Mean similarity in interaction pattern between species of that level, calculated by default as Horn's index (use dist to change this.). Values near 0 indicate no common use of niches, 1 indicates perfect niche overlap. 
togetherness 
Mean number of cooccupancies across all speciescombinations; the whole matrix is scanned for submatrices of the form (0,0,1,1), representing perfect matches of copresences and coabsences. These are counted for each pairwise species combination, and averaged (without weighting). Since the number of species differs between the levels, the same number of cooccupancies will lead to different togethernessvalues for the two levels. Based on Stone & Roberts (1992). 
C score 
(Normalised) mean number of checkerboard combinations across all species of the level. Values close to 1 indicate that there is evidence for disaggregation, e.g. through competition. Value close to 0 indicate aggregation of species (i.e. no repelling forces between species). Since the number of species differs between the levels, the same number of checkerboard patterns will lead to different Cscores for the two levels. See Stone and Roberts (1990) for details. 
V ratio 
Varianceratio of species numbers to interaction numbers within species of a level. Values larger than 1 indicate positive aggregation, values between 0 and 1 indicate disaggregation of species. See Schluter (1984) for details. 
discrepancy 
Discrepancy as proposed by Brualdi & Sanderson (1999); see 
degree distribution 
Coefficients and fits for three different functions to a level's degree distributions: exponential, power law and truncated power law. See 
extinction slope 
Slope of the secondary extinction sequence in one level, following extermination of species in the other level; 
robustness 
Calculates the area below the “secondary extinction” curve; 
functional complementarity 
“Functional complementarity” for a given level. This measure of niche complementarity (as described by Devoto et al. 2012), is computed as the total branch length of a “functional dendrogram” based on qualitative differences of interactions of one level with the other. Thus, the “functional” aspect of functional complementarity refers to the function of sharing interactions. Should be highly correlated with niche overlap, only binary. 
partner diversity 
(Weighted) mean Shannon diversity of the number of interactions for the species of that level. Choose logbase=2 to change to a log2based version. 
generality/vulnerability 
(Weighted) mean effective number of LL species per HL species (generality; HL species per LL species for vulnerability), weighted by their marginal totals (row sums); see Tylianakis et al. (2007) and Bersier et al. (2002). This is identical to exp(“partner diversity”, i.e., simply the Jost (2006)recommended version of diversity. 
If your web returns and NA for some of the indices, this can be because the index cannot be computed. For example, if the web is full (i.e. no 0cells), extinction slopes cannot be fitted (singularity of gradient). Check if you can expect the index to be computable! If it is, and grouplevel
doesn't do it, let me know.
Some indices require rather long computation times on large webs. If you want to increase the speed by omitting some indices, here a rough guide: Ask only for the indices you are interested in! Otherwise, here is the sequence of most timeconsuming indices:
For somewhat larger networks (i.e. more than 2 dozen species per level), weighted cluster coefficient is very time consuming (an exhaustive search for 4loops in the onemode projection of the network). Omitting it can dramatically boost speed.
Typically, the slowest function is related to extinction slopes and robustness. Excluding both makes the function faster.
Degree distributions are somewhat time consuming.
Carsten F. Dormann carsten.dormann@biom.unifreiburg.de
Bascompte, J., Jordano, P. and Olesen, J. M. 2006. Asymmetric coevolutionary networks facilitate biodiversity maintenance. Science 312, 431–433
Bersier, L. F., BanasekRichter, C. and Cattin, M. F. 2002. Quantitative descriptors of foodweb matrices. Ecology 83, 2394–2407
Blüthgen, N. 2010. Why network analysis is often disconnected from community ecology: A critique and an ecologist's guide. Basic and Applied Ecology 11, 185–195
Blüthgen, N., Menzel, F., Hovestadt, T., Fiala, B. and Blüthgen N. 2007 Specialization, constraints and conflicting interests in mutualistic networks. Current Biology 17, 1–6
Devoto M., Bailey S., Craze P., and Memmott J. (2012) Understanding and planning ecological restoration of plantpollinator networks. Ecology Letters 15, 319–328. http://dx.doi.org/10.1111/j.14610248.2012.01740.x
Dormann, C.F., Fründ, J., Blüthgen, N., and Gruber, B. (2009) Indices, graphs and null models: analysing bipartite ecological networks. The Open Ecology Journal 2, 7–24.
Dunne, J. A., R. J. Williams, and N. D. Martinez. 2002 Foodweb structure and network theory: the role of connectance and size. Proceedings of the National Academy of Science USA 99, 12917–12922
Gotelli, N. J., and G. R. Graves. 1996 Null Models in Ecology. Smithsonian Institution Press, Washington D.C.
Jost, L. 2006. Entropy and diversity. Oikos 113, 363–375. doi: 10.1111/j.2006.00301299.14714.x
Krebs, C. J. 1989 Ecological Methodology. Harper Collins, New York.
Memmott, J., Waser, N. M. and Price M. V. 2004 Tolerance of pollination networks to species extinctions. Proceedings of the Royal Society B 271, 2605–2611
Müller, C. B., Adriaanse, I. C. T., Belshaw, R. and Godfray, H. C. J. 1999 The structure of an aphidparasitoid community. Journal of Animal Ecology 68, 346–370
Roberts, A. and Stone, L. 1990 Islandsharing by archipelago species. Oecologia 83, 560–567
Schluter, D. (1984) A variance test for detecting species associations, with some example applications. Ecology 65, 9981005.
Stone, L. and Roberts, A. (1990) The checkerboard score and species distributions. Oecologia 85, 74–79.
Stone, L. and Roberts, A. (1992) Competitive exclusion, or species aggregation? An aid in deciding. Oecologia 91, 419–424
Tylianakis, J. M., Tscharntke, T. and Lewis, O.T. (2007) Habitat modification alters the structure of tropical hostparasitoid food webs. Nature 445, 202–205
Watts, D. J. and Strogatz, S. (1998) Collective dynamics of ‘smallworld’ networks. Nature 393, 440–442
This function can (and typically will) be called, with all its arguments, by networklevel
. Several indices have their own function as implementation: second.extinct
, degreedistr
, C.score
and V.ratio
1 2 3 4 5 6  ## Not run:
data(Safariland)
grouplevel(Safariland)
grouplevel(Safariland, level="lower", weighted=FALSE) #excludes degree distribution fits
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.