Learn R Programming

treescape (version 1.10.18)

findGroves: Identify clusters of similar trees

Description

This function uses hierarchical clustering on principal components output by treescape to identify groups of similar trees. Clustering relies on hclust, using Ward's method by default.

Usage

findGroves(x, method = "treeVec", nf = NULL, clustering = "ward.D2", nclust = NULL, ...)

Arguments

x
an object of the class multiPhylo or the output of the function treescape
method
(ignored if x is from treescape) this specifies a function which outputs the summary of a tree in the form of a vector. Defaults to treeVec.
nf
(ignored if x is from treescape) the number of principal components to retain
clustering
a character string indicating the clustering method to be used; defaults to Ward's method; see argument method in ?hclust for more details.
nclust
an integer indicating the number of clusters to find; if not provided, an interactive process based on cutoff threshold selection is used.
...
further arguments to be passed to treescape

Value

A list containing:
  • groups: a factor defining groups of trees
  • treescape: the output of treescape

See Also

plotGroves to display results

Examples

Run this code

if(require("adegenet") && require("adegraphics")){
## load data
data(woodmiceTrees)

## run findGroves: treescape+clustering
res <- findGroves(woodmiceTrees, nf=5, nclust=6)

## plot results on first 2 axes
PCs <- res$treescape$pco$li
s.class(PCs, fac=res$groups, col=funky(6))

## using plotGroves
plotGroves(res)
}


Run the code above in your browser using DataLab