Reshapes community data from individual into stratified form

Share:

Description

Function stratifyvegdata reshapes individual abundance values into species abundance values per size class or combination of size classes. Function as.stratifiedvegdata checks if the input list has appropriate properties and turns it into an object of class 'stratifiedvegdata'.

Usage

1
2
3
4
5
stratifyvegdata(x, sizes1, sizes2 = NULL, treeSel=NULL, spcodes = NULL, 
                plotColumn="plot", speciesColumn = "species", 
                abundanceColumn="abundance", size1Column = "size", size2Column = NULL, 
                cumulative=FALSE, counts=FALSE, mergeSpecies=FALSE, verbose=FALSE)
as.stratifiedvegdata(X)

Arguments

x

A data frame containing individual plant data. Individuals are in rows, while measurements are in columns.

sizes1

A numerical vector containing the breaks for primary size classes in ascending order.

sizes2

A numerical vector containing the breaks for secondary size classes in ascending order.

treeSel

A logical vector specifying which rows in x to be used. By default (treeSel = NULL) all rows are taken.

spcodes

A character vector indicating the codes of species to be used for stratification (species codes beyond those appearing in x are possible). If spcodes = NULL then all species in x are used.

plotColumn

The name of the column in x that contains plot identifiers.

speciesColumn

The name of the column in x that contains species names.

abundanceColumn

The name of the column in x that contains abundance values.

size1Column

The name of the column in x that contains values for primary size classes.

size2Column

The name of the column in x that contains values for secondary size classes.

cumulative

A flag to indicate that cumulative abundance profiles or surfaces are desired.

counts

A flag to indicate that the output should be individual counts instead of added abundance values.

mergeSpecies

A flag to indicate that species identity should be ignored. This leads to analyzing the structure of biomass disregarding species identity.

verbose

A logical flag to indicate extra output.

X

A list with as many elements as plot records. Each element should be of class 'matrix' or 'data.frame' with species in rows and strata in columns. Furthermore, the number of rows (species) and columns (strata) should be the same for all elements.

Details

For each individual (row) in x, stratifyvegdata assigns it to the size class (stratum) containing its size. The corresponding abundance value (e.g. crown cover) of the individual is added to the abundance of the corresponding species at the size class (stratum). If sizes2 and size2Column are supplied, the function assigns each individual (row) in x to the combination of size classes (e.g. tree height and diameter).

Value

Both functions return an object of class 'stratifiedvegdata', which is a list of matrices, one for each plot record. Each element (matrix) has as many rows as species and as many columns as size classes (i.e., as many as elements in vector sizes1). Columns are named starting with 'S' and continuing with the size class (stratum) number. If mergeSpecies=TRUE then all matrices have a single row (whose name is "all"). If sizes2 and size2Column are supplied to stratifyvegdata, the function returns an object of class 'doublestratifiedvegdata', which is a list of arrays, one for each plot record. Each element (array) has three dimensions corresponding to species, primary sizes (number of elements in in vector sizes1) and secondary sizes (number of elements in in vector sizes2). If cumulative=TRUE then the function returns cumulative abundances (see CAP and CAS).

Author(s)

Miquel De Cáceres, Forest Science Center of Catalonia.

References

De Cáceres, M., Legendre, P. & He, F. (2013) Dissimilarity measurements and the size structure of ecological communities. Methods in Ecology and Evolution 4: 1167-1177.

See Also

reshape, CAP, CAS

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Load tree data
data(treedata)

## Inspect tree data
head(treedata)

## Define stratum thresholds (4 strata)
heights = seq(0,4, by=0.5)
diameters = seq(0,2, by=0.5)

## Stratify tree data using heights as structural variable
X = stratifyvegdata(treedata, sizes1=heights, plotColumn="plotID",
                    speciesColumn="species", size1Column="height", counts=TRUE)

## Inspect the second plot record
X[[2]]

## Stratify tree data using heights as structural variable and cover as abundance
Y = stratifyvegdata(treedata, sizes1=heights, plotColumn="plotID",
                    speciesColumn="species", size1Column="height", 
                    abundanceColumn="cover")
Y[[2]]

## Stratify tree data using heights and diameters as structural variables
Z = stratifyvegdata(treedata, sizes1=heights, sizes2=diameters, plotColumn="plotID",
                    speciesColumn="species", size1Column="height", size2Column="diam",
                    counts=TRUE)
Z[[2]]

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