View source: R/stratifyvegdata.R
stratifyvegdata | R Documentation |
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
'.
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)
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 |
spcodes |
A character vector indicating the codes of species to be used for stratification (species codes beyond those appearing in |
plotColumn |
The name of the column in |
speciesColumn |
The name of the column in |
abundanceColumn |
The name of the column in |
size1Column |
The name of the column in |
size2Column |
The name of the column in |
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. |
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).
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
).
Miquel De Cáceres, CREAF.
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.
reshape
, CAP
, CAS
## 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]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.