Learn R Programming

bipartite (version 2.05)

frame2webs: Converts a table of observations into a network matrix

Description

Convenience function to convert a table of observations (typically compiled in a spreadsheet programm) into a network matrix for further use in bipartite.

Usage

frame2webs(dframe, varnames = c("lower", "higher", "webID", "freq"), type.out = 
"list", emptylist = TRUE)

Arguments

dframe
table (i.e. data.frame) of observations, typically simply the data read by one of the read.* functions; see Details for details!
varnames
a vector of characters giving the column names in the table (data.frame) that correspond to
  • species names in lower trophic level (e.g. plants),
  • species names in higher trophic level (e.g. pollinators),
  • the grouping factor for a
type.out
defines the type of output; it could be (default) or an with a separate slice for each network. Lists have the advantage that different webs do not have to include all species names, i.e. they can be of differe
emptylist
logical, defaults to ; should, for each network in the list of networks, empty columns and rows be deleted? Since this function first builds an array and from that a list, each network contains all possible links between species of th

Value

  • A list or an array of networks, each to be used as input for other bipartite functions.

encoding

UTF-8

Details

This function supports the easy handling of typical recording that are used to compose a network. The assumed structure of the underlying table is two columns for the names of the lower and higher level species, respectively, one column for a network ID (e.g. site, observer or any other grouping code) and, optionally, a number that indicates how often this interaction was observed. If not given, the number of interactions is simply computed from the number of times the same interaction occurred for each network ID. See example code below. Typically, data are recorded (in a field book or external data logging device), read into a spreadsheet software (such as MS Excel or Open/LibreOffice Spreadsheet), where names are checked, typos corrected and so forth. This table is then imported into R and aggregated into one or more webs (or an array or a list of webs) using frame2webs. Each link can have multiple entries or a single entry!

See Also

empty

Examples

Run this code
testdata <- data.frame(higher = c("bee1","bee1","bee1","bee2","bee1","bee3"), 
lower = c("plant1","plant2","plant1","plant2","plant3","plant4"), 
webID = c("meadow","meadow","meadow","meadow","bog","bog"), freq=c(5,1,1,1,3,7))
frame2webs(testdata,type.out="array")
sapply(frame2webs(testdata,type.out="list"), networklevel, index=c("connectance", "C score"))

Run the code above in your browser using DataLab