Skip to contents

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

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

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.

Author

Miquel De Cáceres, CREAF.

See also

Examples

## Load tree data
data(treedata)

## Inspect tree data
head(treedata)
#>   plotID species height cover      diam
#> 1      1       H      4   0.2 1.1328793
#> 2      1       H      4   0.2 1.1630979
#> 3      1       H      4   0.2 1.0639817
#> 4      2       H      4   0.2 1.0959077
#> 5      2       O      1   0.2 0.7445254
#> 6      2       H      4   0.2 1.1514505

## 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]]
#>   [0,0.5] (0.5,1] (1,1.5] (1.5,2] (2,2.5] (2.5,3] (3,3.5] (3.5,4]
#> H       0       0       0       0       0       0       0       3
#> N       0       0       0       0       0       0       0       0
#> O       0       2       0       0       0       0       0       0

## 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]]
#>   [0,0.5] (0.5,1] (1,1.5] (1.5,2] (2,2.5] (2.5,3] (3,3.5] (3.5,4]
#> H       0     0.0       0       0       0       0       0     0.6
#> N       0     0.0       0       0       0       0       0     0.0
#> O       0     0.4       0       0       0       0       0     0.0

## 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]]
#> , , [0,0.5]
#> 
#>   [0,0.5] (0.5,1] (1,1.5] (1.5,2] (2,2.5] (2.5,3] (3,3.5] (3.5,4]
#> H       0       0       0       0       0       0       0       0
#> N       0       0       0       0       0       0       0       0
#> O       0       0       0       0       0       0       0       0
#> 
#> , , (0.5,1]
#> 
#>   [0,0.5] (0.5,1] (1,1.5] (1.5,2] (2,2.5] (2.5,3] (3,3.5] (3.5,4]
#> H       0       0       0       0       0       0       0       0
#> N       0       0       0       0       0       0       0       0
#> O       0       2       0       0       0       0       0       0
#> 
#> , , (1,1.5]
#> 
#>   [0,0.5] (0.5,1] (1,1.5] (1.5,2] (2,2.5] (2.5,3] (3,3.5] (3.5,4]
#> H       0       0       0       0       0       0       0       3
#> N       0       0       0       0       0       0       0       0
#> O       0       0       0       0       0       0       0       0
#> 
#> , , (1.5,2]
#> 
#>   [0,0.5] (0.5,1] (1,1.5] (1.5,2] (2,2.5] (2.5,3] (3,3.5] (3.5,4]
#> H       0       0       0       0       0       0       0       0
#> N       0       0       0       0       0       0       0       0
#> O       0       0       0       0       0       0       0       0
#>