makecommunitydataset: Make a Community Dataset from a Stacked Dataset

Description Usage Arguments Details Value Author(s) References Examples

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
2
makecommunitydataset(x, row, column, value, factor="", level="", drop=F)
stackcommunitydataset(comm, remove.zeroes=FALSE, order.sites=FALSE, order.species=FALSE)

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)

comm

Community data set

remove.zeroes

Should rows with zero abundance be removed?

order.sites

Should sites be ordered alphabetically?

order.species

Should species be ordered alphabetically?

Details

makecommunitydataset 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.

stackcommunitydataset reverses the actions of makecommunitydataset and recreates the data in stacked format.

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
12
13
14
15
## 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')

# recreate the original stack
dune.stacked2 <- stackcommunitydataset(dune.comm2, remove.zeroes=T)


## End(Not run)

BiodiversityR documentation built on May 19, 2017, 1:41 p.m.

Search within the BiodiversityR package
Search all R packages, documentation and source code