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

1
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)

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.

Value

The function provides a community dataset from another data frame.

Author(s)

Roeland Kindt (World Agroforestry Centre)

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/output/tree-diversity-analysis

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
dune.file <- normalizePath(paste(system.file(package="BiodiversityR"), 
    '/etc/dunestacked.csv', sep=''))
dune.stacked <- read.csv(dune.file)

# dune.stacked has different variables for sites, species and abundance
head(dune.stacked)
dune.comm2 <- makecommunitydataset(dune.stacked, row='sites', column='species', 
    value='abundance')

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.