This script below runs nicely to get the cluster with a huge data set, but I need to get the cluster into a newick file or a text file so I can export it from R to other editing programs but I can't find a way to get the hclust into a newick format, how can I do it? I feel the new2phylo function may do the job but we did not manage to make it work.
I would really appreciate your help as we have searched everywhere and can't find a solution =(
datos <- read.table("morphclustersred.csv",header=T,sep="\t")
head(datos)
distfunc <- function(x) daisy(x,metric="gower")
d <- distfunc(datos)
hclustfunc <- function(x) hclust(x, method="complete")
fit <- hclustfunc(d)
plot(fit)
plot(fit, labels=datos$Species,main='Morphological Clustering')
rect.hclust(fit, k=5, border="red")