Learn R Programming

dave (version 2.0)

centroid: Centroids of row groups (vegetation releves)

Description

Given a two-dimensional data frame or matrix of vegetation data and group membership of rows (releve classification) a new matrix is derived with relative species frequency (0 to 1 scale) within groups. The matrix of centroids has as many rows as there are row groups in the vegetation matrix and the same number of columns (species).

Usage

centroid(nveg, grel,y,...)

# S3 method for default centroid(nveg, grel,y,...) # S3 method for centroid print(x,...)

Arguments

nveg

A data frame of vegetation releves (rows) by species (columns)

grel

A vector containing group membership of releves (rows), typically generated by hclust and cutree

y

Transformation of species scores: x'= x exp(y)

Further variables used for printing

x

A list of class "centroid" generated by centroid

Value

An output list of class "centroid" with at least the following items:

nrelgroups

Number of rows of centroid table

nspec

Number of columns of centroid table

freq.table

A table of species frequencies within groups, unadjusted

prob.table

A table of species frequencies within groups, adjusted (0-1)

dist.mat

An nrelgroups by nrelgroups distance matrix of centroids

References

Wildi, O. 2017. Data Analysis in Vegetation Ecology. 3rd ed. CABI, Oxfordshire, Boston.

Examples

Run this code
# NOT RUN {
# This generates a typical artificial vegetation data frame aveg
v1<- matrix(rep(0,200),nrow=10)        
diag(v1)<-1 ; diag(v1[,2:12])<-1 ; diag(v1[,3:13])<-2 ; diag(v1[,4:14])<-1
diag(v1[,5:15])<-1 ; diag(v1[5:8,3:6])<-3 ; aveg<- data.frame(v1[,2:13])

# First, groups of releves are formed by cluster analysis
require(vegan)
dr<- vegdist(aveg^0.5,method="bray")      # dr is distance matrix of rows
o.clr<- hclust(dr,method="ward")          # this is clustering
grel<- cutree(o.clr,k=3)                  # 3 row groups formed
o.centroid<- centroid(aveg,grel,y=0.5)
o.centroid                                # printing the matrix

# }

Run the code above in your browser using DataLab