Learn R Programming

bipartite (version 2.18)

array2linkmx: Reshape a webarray to a web X link matrix

Description

Function to turn an array with sites as third dimension into a web by link matrix (e.g. sites X links). This is the "link community matrix" to use for dissimilarity calculations. Mostly just a helper function for betalinkr.

Usage

array2linkmx(webarray)

Value

A matrix with one row per web and one column per link (i.e. per combination of lower and higher species). All-zero columns may often be included.

Arguments

webarray

An array of two or more networks. Assumes the third dimension is the webID in the array, which will become the first dimension in the link-matrix (output).

Author

Jochen Fründ

Details

This function converts the two-dimensional adjacency matrices (i.e., bipartite webs) to one-dimensional vectors (similar to what network people call ``edgelists''). These vectors become rows of a matrix (which has one row per web). This makes the data available to community ecology methods, e.g. those offered by the vegan package. Links are treated equivalently to species in a ``normal'' community analysis (note that it makes no difference whether one or both partner of an interaction differ, in both cases the link has a different identity). The function is used here mostly as a helper for interaction dissimilarity calculations with betalinkr.

dimnames are optional but recommended for the webarray. Names of the third dimension will become rownames in the output. Colnames (i.e. names of links) will be created from dimnames[[1]] (``lower species'') and dimnames[[2]] (``higher species''), separated by ``__'' (double underscore).

Examples

Run this code
array2linkmx(webs2array(Safariland, vazquenc))

Run the code above in your browser using DataLab