[R] Drawing a tree in R

2008-11-26 Thread Severin Hacker
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

__
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.


Re: [R] Drawing a tree in R

2008-11-30 Thread peterdc


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.

__
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.