synsort: Sorting functions for synoptic tables

View source: R/synsort.R

synsortR Documentation

Sorting functions for synoptic tables

Description

This function sorts synoptic tables from syntable function output. Sorting criteria can be either numerical values in synoptic tables, such as cluster-wise frequencies or fidelity measures, as well as combined criteria that also take into account differential character (according to the criteria defined by Tsiripidis et al., 2009).

The algorithm aims to sort species to blocked structure considering the defined criteria and input tables, with the best characterizing species on the top of the block, followed by species with descending importance for plant community description.

Usage

synsort(
  syn1,
  syn2 = syn1,
  matrix,
  cluster,
  method = "allspec",
  min1 = 0,
  min2 = 0
)

Arguments

syn1

Input synoptic table 1, a data frame with numerical data format, usually from syntable function output. See Details for input table format. The values of this table will be displayed in the final output table.

syn2

Optional second input table with additional numeric or differential character sorting criteria.

matrix

Species-sample matrix, already used for syntable function input

cluster

Integer or character vector/factor with classification cluster identity. Ensure matching order of cluster identity and samples in matrix for correct allocation of cluster numbers to samples.

method

Sorting algorithm and synoptic table output options (method = c("allspec", "alldiff")). See Details.

min1

Cluster-wise threshold minimum value for species shown in the final sorted synoptic table. Species below that minimum will be listed in the output ($others section).

min2

Threshold minimum value for considering species values of a numerical second input table syn2. Species below that minimum will not be displayed in final synoptic table, but will be listed in the output ($others section).

Value

Returns an (invisible) list composed of:

  • $output Sorting method description

  • $species Information to species included in the output table

  • $samplesize Sample sizes in clusters

  • $syntable Sorted synoptic table, with the numeric values of syn1 in the left-side columns and differential character of species on the right-side of the output table. See Tsiripidis et al. (2009) for details and criteria for the assignment of a differential species as p = positive, n = negative, pn = positive/negative.

  • $others Species that are omitted in Synoptic table due to their failing reaching the given threshold values min1 and min2. Sorted alphabetically.

  • $samples Sorted original species-sample matrix, with original Plot-IDs (as column names) and the cluster identity (Cluster_No as first row of output samples table)

Details

Two types of sorted synoptic tables can be created with this function:

  • method = "allspec" (default) creates a sorted synoptic table basing on one or two numeric input tables, e.g. percentage or absolute frequencies, or phi fidelity values. Sorting criteria can be either given by only one input table by using only syn1 argument, as well as by two input tables with specifying syn2, too. Thereby, only values of syn1 will be shown in the final sorted table.

  • method = "alldiff": With including differential species character as sorting criteria, syn1 must be numeric (e.g. percentage frequency) and syn2 must contain information on differential character (output from syntable function with defined type = "diffspec"). The result table shows ALL diagnostic and non-diagnostic species, as long as they match the min1 and min2 thresholds. The algorithm detects highest cluster values of species calculated from syn1 as base for sorting, but will consider differential character criterion from syn2 as well. Species with high values in syn1 AND positive differential character will then be listed on the top of a species block. Within such a block, the differentiating and high-abundant species are sorted in a way favoring species that are positive in only one or at least few clusters.

Author(s)

Jenny Schellenberg (jschell@gwdg.de)

References

Bruelheide, H. (2000): A new measure of fidelity and its application to defining species groups. Journal of Vegetation Science 11: 167-178. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.2307/3236796")}

Chytry, M., Tichy, L., Holt, J., Botta-Dukat, Z. (2002): Determination of diagnostic species with statistical fidelity measures. Journal of Vegetation Science 13: 79-90. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.1111/j.1654-1103.2002.tb02025.x")}

Sokal, R.R. & Rohlf, F.J. (1995): Biometry. 3rd edition Freemann, New York.

Tsiripidis, I., Bergmeier, E., Fotiadis, G. & Dimopoulos, P. (2009): A new algorithm for the determination of differential taxa. Journal of Vegetation Science 20: 233-240. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.1111/j.1654-1103.2009.05273.x")}

See Also

syntable

Examples

### Synoptic table of Scheden vegetation data using syntable()-function:
# classification to create a vector of cluster identity
library(cluster)
pam1 <- pam(schedenveg, 4)


### One input table for sorting:
## Synoptic table with percentage frequency of species in clusters, all species
unordered <- syntable(schedenveg, pam1$clustering, abund = "percentage",
                      type = "percfreq")   # Unordered synoptic percentage frequency table
sorted <- synsort(syn1 = unordered$syntable, matrix = schedenveg,
                  cluster = pam1$clustering, method = "allspec", min1 = 0)
sorted             # view results
## Not run: 
# Export sorted synoptic table
write.csv(sorted$syntab, "syntab.csv")
# Export sorted species-sample matrix with original releve data for postprocessing
write.csv(sorted$samples, "output_species_sample.csv")
## End(Not run)

## Synoptic table with only phi values
phi <- syntable(schedenveg, pam1$clustering, abund = "percentage",
                     type = "phi")         # calculates cluster-wise phi for each species
phi_table <- synsort(syn1 = phi$syntable, matrix = schedenveg, cluster = pam1$clustering,
                     method = "allspec", min1 = 0.3)
phi_table     # view results


### Two numerical tables for sorting:
## Synoptic table showing percentage frequencies, but only for species with minimum phi-value
## of 0.3 AND exclude species with less than 25% percentage frequency

unordered <- syntable(schedenveg, pam1$clustering, abund = "percentage",
                      type = "percfreq")   # Unordered synoptic percentage frequency table
phitable <- syntable(schedenveg, pam1$clustering, abund = "percentage",
                     type = "phi")         # calculates cluster-wise phi for each species
# now sorting and arranging
phi_complete <- synsort(syn1 = unordered$syntable, syn2 = phitable$syntable,
                       matrix = schedenveg, cluster = pam1$clustering, method = "allspec",
                       min1 = 25, min2 = 0.3)
phi_complete      # view results

### Differential species analysis
differential <- syntable(schedenveg, pam1$clustering, abund = "percentage",
                         type = "diffspec")

## Synoptic table with percentage frequency (only species >25%) and
## differential character.
complete <- synsort(syn1 = unordered$syntable, syn2 = differential$syntable,
                    matrix = schedenveg, cluster = pam1$clustering,
                    method = "alldiff", min1 = 25)
complete            # view result table
differential$differentials  # list differential species for clusters


fgoral/goeveg documentation built on Feb. 27, 2024, 6:32 a.m.