Learn R Programming

BiodiversityR (version 1.5)

makecommunitydataset: Make a Community Dataset from a Stacked Dataset

Description

Makes a community data set from a stacked dataset (with separate variables for the site identities, the species identities and the abundance).

Usage

makecommunitydataset(x,row,column,value,factor="",level="",drop=F)

Arguments

x
Data frame.
row
Name of the categorical variable for the rows of the crosstabulation (typically indicating sites)
column
Name of the categorical variable for the columns of the crosstabulation (typically indicating species)
value
Name of numerical variable for the cells of the crosstabulation (typically indicating abundance). The cells provide the sum of all values in the data frame.
factor
Name of the variable to calculate a subset of the data frame.
level
Value of the subset of the factor variable to calculate a subset of the data frame.
drop
Drop rows without species (species with total abundance of zero are always dropped)

Value

  • The function provides a community dataset from another data frame.

Details

This function calculates a cross-tabulation from a data frame, summing up all the values of the numerical variable identified as variable for the cell values. If factor="", then no subset is calculated from the data frame in the first step.

References

Kindt, R. & Coe, R. (2005) Tree diversity analysis: A manual and software for common statistical methods for ecological and biodiversity studies. http://www.worldagroforestry.org/resources/databases/tree-diversity-analysis

Examples

Run this code
library(vegan)
data(dune.env)
makecommunitydataset(dune.env,row='Manure',column='Use',value='A1')
makecommunitydataset(dune.env,row='Manure',column='Use',value='A1',
    factor='Management',level='NM')

Run the code above in your browser using DataLab