twin2mat: Extract Transformed Input Data from twinspan Result

twin2stackR Documentation

Extract Transformed Input Data from twinspan Result

Description

Functions extract the data twinspan used in its analysis, and allow reproducing the internal ordination and inspecting the twinspan divisions.

Usage

twin2stack(x, subset, downweight = TRUE)

twin2mat(x)

twin2specstack(x, subset, downweight = TRUE)

Arguments

x

twinspan result object.

subset

Select a subset of quadrats (twin2stack) or species (twin2specstack).

downweight

Downweight infrequent pseudospecies.

Details

Function twin2stack extracts the pseudospecies matrix, where columns are pseudospecies with their cutlevels. This is similar to the file generated with twinsform. The default is to return a binary matrix, where data entries are eiter 0 or 1. Alternatively, it is possible to extract a subset of data with downweighting allowing scrutiny of twinspan divisions. When downweighted data are ordinated with correspondence analysis (such as vegan functions cca, decorana with ira=1) the first eigenvalue will match the eigenvalue in twinspan, and when a division is used as a subset, its eigenvalue will match with twinspan.

Function twin2mat extracts data file with pseudospecies transformation. Columns are original species, and entries are abundances after pseudospecies transformation. This is similar as the output from vegan function coverscale with similar cut levels and argument character=FALSE. These data were not analysed in twinspan, but these are the data tabulated with twintable.

Function twin2specstack returns similar data as used in species classification in twinspan. In this matrix, species are rows and columns are “pseudocluster” preferences. The preference of each species in each terminal group and internal division is estimated as proportion of its abundance (in pseudospecies scale, see twin2mat) in the group and all data. If this proportion is 0.8 or higher, species is regarded as present at pseudocluster value 1, if it is 2 or higher at value 2, and if it is 6 or higher at value 3. With downweight=FALSE these data are returned. The columns are named by their division or cluster number followed a, b and c for pseudocluster levels (and including zero columns). In default, the pseudocluster values are still downweighted using species frequencies as weights, and then rows are weighted by species frequencies and columns by their totals extended to the same lowest level of classification, giving two times higher weight to higher “pseudocluster” levels b and c. When ordinated with correspondence analysis (cca, decorana with ira=1) this gives similar eigenvalue for the first axis as in twinspan, and when a division is used as a subset, similar eigenvalue as in that division.

See Also

For original data set instead of twinspan result, functions twinsform and coverscale are analogous to twin2stack and twin2mat.

Examples


data(ahti)
dim(ahti)
range(ahti)
tw <- twinspan(ahti)
x <- twin2mat(tw)
dim(x)
range(x)
colnames(x)
x <- twin2stack(tw, downweight = FALSE)
dim(x)
range(x)
colnames(x)
## Inspect group 4
x <- twin2stack(tw, subset = twingroup(tw, 4), downweight = TRUE)
## need vegan for correspondence analysis
if (suppressPackageStartupMessages(require("vegan"))) {
cca(x)
}
## species classification
x <- twin2specstack(tw)
if (suppressPackageStartupMessages(require("vegan"))) {
cca(x)
}


jarioksa/twinspan documentation built on Nov. 23, 2024, 2:49 p.m.