[R] Drawing a tree in R

peterdc cowan.pd at gmail.com
Sat Nov 29 20:32:26 CET 2008



Severin Hacker wrote:
> 
> Hi,
> 
> I've been trying to make use of the dendrogram class to plot a tree.
> However, my attempts have failed so far because I'm not sure how to build
> up the nested list. (where do I have to store the nodes?). The tree I want
> to be drawn is like this: in the form (node, left child,right child)
> (root,(n1,1,(n2,2,3)),4) 
> 
> If it is not easily possible to draw a tree with the help of the
> dendrogram class I'm open to any other method to draw a tree in R!!
> 
> Thanks!
> 
> -Severin
> 
> 

Severin,

Check out the R package ape for plotting phylogenetic trees.  

require(ape)
foo <- read.tree(text = "(root,(n1,1,(n2,2,3)),4);")
plot(foo)

HTH

Peter 
-- 
View this message in context: http://www.nabble.com/Drawing-a-tree-in-R-tp20711698p20749736.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list