Learn R Programming

EcotoneFinder (version 0.2.3)

clustergram.kmeans: Type function that clustergram takes for clustering.

Description

Type function that clustergram takes for clustering.

Usage

clustergram.kmeans(Data, k, ...)

Arguments

Data

Should be a scales matrix. Where each column belongs to a different dimension of the observations

k

Number of desired groups for the k-means clustering.

...

Additional parameters to be passed in the kmeans function (from the stats package).

Value

A list containing the cluster vector and the centers matrix (see kmeans function).

Details

This is the type of function that the clustergram function uses for clustering. The return list is internally used by the clustergram to build the clustergram plot.

Examples

Run this code
# NOT RUN {
  ####### Example data:
   SyntheticTrial <- SyntheticData(SpeciesNum = 100,
                                   CommunityNum = 3, SpCo = NULL,
                                   Length = 500,
                                   Parameters = list(a=c(40, 80, 50),
                                                     b=c(100,250,400),
                                                     c=rep(0.03,3)),
                                   dev.c = .015, pal = c("#008585", "#FBF2C4", "#C7522B"))

   ######## 6 clustergram plots
   for (i in 1:6) clustergram(as.matrix(SyntheticTrial[,2:ncol(SyntheticTrial)]),
                              clustering.function = clustergram.kmeans,
                              k.range = 2:10, line.width = .2)

# }

Run the code above in your browser using DataLab