!head /Users/epi/pg_site1.csv
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 16001,82,4.312,32.832,63.28,49 16001,77,4.325,32.828,65.65,46 16001,77,4.302,32.821,62.36,47 16001,71,4.299,32.832,65.84,37 16001,70,4.302,32.821,62.54,49
%load_ext rmagic
%%R
library(vegan)
Carico il pacchetto richiesto: permute This is vegan 2.0-7
%%R
mat<-read.csv("http://epi.whoi.edu/ipython/results/mdistefano/pg_site1.csv",header=T)
%%R
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),]
%%R
distmat<-vegdist(dd)
%%R
clusa<-hclust(distmat,"average")
%%R
print(clusa)
Call: hclust(d = distmat, method = "average") Cluster method : average Distance : bray Number of objects: 8036
%%R
print(dend1 <- as.dendrogram(clusa))
'dendrogram' with 2 branches and 8036 members total, at height 0.3194225
%%R
plot(dend1)
%%R
dend2 <- cut(dend1, h=0.07)
plot(dend2$upper)
plot(dend2$lower[[1]])
lines = !jist -p hclust.ipynb
print lines[0].replace("https://gist.github.com", "http://nbviewer.ipython.org")