[R-sig-eco] visualisation clusters in an ordination plot

Jari Oksanen jari.oksanen at oulu.fi
Tue Feb 14 15:38:25 CET 2012


Dear Maud Raman,
On 14/02/2012, at 16:29 PM, RAMAN, Maud wrote:
> Hi
> 
> I would like to make a CA with visualisation of the clusters of the cluster analysis I've made. I'm using the package Vegan.
> 
> I've tried as an exercice this script:
> data(dune)
> data(dune.env)
> mod <- cca(dune ~ Management, dune.env)
> attach(dune.env)
> plot(mod, type = "p", display="sites")
> ordicluster(mod, hclust(vegdist(dune)), prune=3, col = "blue")
> 
> And wanted to do the same with mine
> # transformation of dataset (Hellinger) and creating a distancematrix
> KSSA6.hel<-decostand(KSSA6,"hel")
> KSSA6.dishel<-dist(KSSA6.hel)
> #clusteranalyse ward
> KSSA6w.fc <- hclust(KSSA6.dishel^2, "ward")
> clusterw7.fc <- cutree(KSSA6w.fc, k = 7)
> # ca - ordinatie
> KSSA6olhel.ca<- cca(KSSA6.ol.hel)
> plot(KSSA6olhel.ca, type = "p", display="sites")
> ordicluster(KSSA6olhel.ca, clusterw7.fc, prune=3, col = "blue")
> 
....
> 
> But recieved this error message
> ordicluster(KSSA6olhel.ca, clusterw7.fc, prune=3, col = "blue")
> Error in cluster$merge : $ operator is invalid for atomic vectors
> 
> Does anyone knows what problem this is or give me an alternative?
> 
An obvious problem is that the second argument of ordicluster() must be a hclust() result (cluster tree), but you gave it a cutree result (a classification vector). The following may work:

ordicluster(KSSA6olhel.ca, KSSA6w.fc, prune=6, col = "blue")

(I also changed the value of 'prune' to reflect your cutree class number).

The cutree result can be used with other visualisation methods such as ordispider, ordihull and ordiellipse.

Cheers, Jari Oksanen

-- 
Jari Oksanen, Dept Biology, Univ Oulu, 90014 Finland
jari.oksanen at oulu.fi, Ph. +358 400 408593, http://cc.oulu.fi/~jarioksa



More information about the R-sig-ecology mailing list