Skip to contents

Allows studying the constancy table (i.e. the frequency of species in each class) of a classification represented in the form of a membership data matrix.

Usage

clustconst(x, memb)
# S3 method for class 'clustconst'
summary(object, mode="all", name=NULL, sort=TRUE, minconst=0.5, digits=3, ...)

Arguments

x

Community data, a site by species data frame.

memb

An site-by-group matrix indicating the (hard or fuzzy) membership of each object in x to a set of groups.

object

An object of class 'clustconst'.

mode

Use mode="all" to print the constancy table, mode="cluster" to print constancy values for one cluster, and mode="species", to print constancy values for one species.

name

A string with the name of a cluster (in mode="cluster"), or the name of a species (in mode="species").

sort

A flag to indicate whether constancy table should be sorted in descending order.

minconst

A threshold used to limit the values shown.

digits

The number of digits for rounding.

...

Additional parameters for summary (actually not used).

Details

The constancy value of a species in a vegetation unit is the relative frequency of occurrence of the species in plot records that belong to the unit. In case of a fuzzy vegetation unit the constancy value is the sum of memberships of sites that contain the species divided by the sum of memberships of all sites. Use the 'summary' function to obtain information about: (1) which species are more frequent on a given vegetation unit; (2) which vegetation units have higher frequencies of a given target species. Additionally, the 'summary' function can sort a constancy table if mode="all" and sort=TRUE are indicated.

Value

Function clustconst returns an object of type 'clustconst', in fact a data frame with the constancy value of each species (rows) on each cluster (column).

Author

Miquel De Cáceres, CREAF

See also

Examples

## Loads stats
library(stats)  

## Loads data  
data(wetland)
  
## This equals the chord transformation 
## (see also \code{\link{decostand}} in package 'vegan')
wetland.chord = as.data.frame(sweep(as.matrix(wetland), 1, 
                              sqrt(rowSums(as.matrix(wetland)^2)), "/"))

## Performs a K-means clustering
wetland.km = kmeans(wetland.chord, centers=3, nstart=10)

## Gets constancy table of KM (i.e. hard) clusters
c=clustconst(wetland.chord, memb=as.memb(wetland.km$cluster))

## Prints constancy values ordered and store the result in d
d=summary(c, mode="all")
#> ------------ 3 -------------
#>            3     1     2
#> Phynod 1.000 0.200 0.000
#> Helind 0.786 0.100 0.471
#> Elesp. 0.643 0.000 0.471
#> ------------ 1 -------------
#>            3     1     2
#> Melcor 0.786 1.000 0.294
#> Eupvac 0.286 0.900 0.118
#> Pancam 0.429 0.800 0.118
#> Sessp. 0.429 0.700 0.412
#> Cynarc 0.071 0.600 0.000
#> ------------ 2 -------------
#>            3     1     2
#> Orysp. 0.429 0.100 1.000
#> Ludads 0.000 0.000 0.824

## Prints the most frequent species in the first cluster
summary(c, mode="cluster", name=names(c)[1])
#> Melcor 1.000 
#> Eupvac 0.900 
#> Pancam 0.800 
#> Sessp. 0.700 
#> Cynarc 0.600