[R] plotting radial dendrograms

Carson Farmer carson.farmer at gmail.com
Thu Jun 17 13:50:28 CEST 2010


Dear list,

I am trying to plot a radial dendrogram using the ape package, which
requires my data to be of class 'phylo'. Currently I have my
dendrogram stored as an object of class 'dendrogram' which was
produced from an outside bit of C code, but was made into an object of
class 'igraph.eigenc' and converted to a dendrogram using
'as.dendrogram()' from the igraph package. I would like to find a way
to convert this dendrogram to a 'phylo' object, either directly, or
through conversion via 'hclust'. I have tried creating an 'hclust'
object 'manually' but keep running into "Error: segfault from C stack
overflow" when I try to plot it:

> result <- list()
> result$merge<-merges
> result$method <- NULL
> result$dist.method <- "modularity"
> result$height <- seq(length(merges[,1]),1,-1)
> result$order <- seq(length(merges[,1])+1)
> result$call <- "some call"
> class(result) <- "hclust"
> plot(result)

where merges is a two column matrix of cluster joins that looks
something like this:

> merges
     [,1] [,2]
[1,]    0    2
[2,]    3    1

The dendrogram object was created using something like this:

> result <- list()
> class(result) <- "igraph.eigenc"
> result$merges <- merges
> result$membership <- membership
> dend <- as.dendrogram(result)

where merges is as above, and membership is:

> membership
[1] 0 0 0 0 0 2 2 2 2 2 1 1 1 1 1

Any thoughts on how to convert a dendrogram object to an hclust or
phylo object, or barring that, another way to plot a radial dendrogam
in R?

Regards,

Carson

-- 
Carson J. Q. Farmer
ISSP Doctoral Fellow
National Centre for Geocomputation
National University of Ireland, Maynooth,
http://www.carsonfarmer.com/



More information about the R-help mailing list