Hi All, i've problem to understand how to work with R to generate a hierarchical clustering my data are in a csv and looks like :
idcode,count,temp,sal,depth_m,subs 16001,136,4.308,32.828,63.46,47 16001,109,4.31,32.829,63.09,49 16001,107,4.302,32.822,62.54,47 16001,87,4.318,32.834,62.54,48 16002,82,4.312,32.832,63.28,49 16002,77,4.325,32.828,65.65,46 16002,77,4.302,32.821,62.36,47 16002,71,4.299,32.832,65.84,37 16002,70,4.302,32.821,62.54,49 where idcode is a specie identification number and the other fields are environmental parameters. library(vegan) mat<-read.csv("http://epi.whoi.edu/ipython/results/mdistefano/pg_site1.csv",header=T) dd <- mat[!is.na(mat$idcode) & !is.na(mat$temp) & !is.na(mat$sal) & !is.na(mat$count) & !is.na(mat$count) & !is.na(mat$subs),] distmat<-vegdist(dd) clusa<-hclust(distmat,"average") print(clusa) Call: hclust(d = distmat, method = "average") Cluster method : average Distance : bray Number of objects: 8036 print(dend1 <- as.dendrogram(clusa)) 'dendrogram' with 2 branches and 8036 members total, at height 0.3194225 dend2 <- cut(dend1, h=0.07) a complete run with plots is available here : http://nbviewer.ipython.org/5492912 i'm trying try to group together the species (idcode's) that are sharing similar environmental parameters like (looking at the plots) i should be able to retrieve the list of idcode for each branch at "cut-level" X in the example : X = 0.07 branches1 : [idcodeA, .. .. ,idcodeJ] .. .. branche6 : [idcodeB, .. .. , idcodeK] Many thanks for your precious help!!! Massimo. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.