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

empty

Deletes empty rows and columns from a matrix.


Description

Gets rid of empty columns and rows in a matrix. Optionally counts removed rows and columns, and returns these values as attribute.

Usage

empty(web, count=FALSE)

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.

count

Logical. Shall be counted how many columns and rows were removed? Numbers are returned in attribute. Defaults to FALSE.

Details

Helper function to remove empty (i.e. all-zero or all-NA) rows and columns, thereby concentrating the matrix. This function is also invoked for its side effect by extinction to investigate the effect of removing a species from the network.

Value

Returns matrix without empty rows or columns. Its attribute ‘out’ (if count=TRUE) contains a named vector with the number of rows removed and the number of columns removed.

Author(s)

Carsten F. Dormann

See Also

extinction and second.extinct, which repeatedly call empty.

Examples

data(Safariland)
web <- Safariland
web[,5] <- 0
empty(web, count=TRUE)
attr(empty(web), "empty")

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.