[Picante-commits] r208 - in branches/will: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Nov 20 06:28:30 CET 2009


Author: will_cornwell
Date: 2009-11-20 06:28:30 +0100 (Fri, 20 Nov 2009)
New Revision: 208

Added:
   branches/will/R/node.desc.R
   branches/will/man/node.desc.Rd
Log:
removing Geiger dependancy

Added: branches/will/R/node.desc.R
===================================================================
--- branches/will/R/node.desc.R	                        (rev 0)
+++ branches/will/R/node.desc.R	2009-11-20 05:28:30 UTC (rev 208)
@@ -0,0 +1,29 @@
+
+#modified from a function by Walton Green, Gene Hunt, Scott Wing
+#found at http://bricol.net/research/extinctmodel/Rfunctions/lop.R
+node.desc<- function(tr, node)
+# returns vector of decendents for a particular node
+{
+ ee<- tr$edge
+ nT<- length(tr$tip.label)
+ nN<- tr$Nnode
+ d.tips<- numeric()
+ d.nodes<- numeric()
+    
+ desc<- ee[ee[,1]==node,2]
+ #print (desc)
+ d.tips<- append(d.tips, desc[desc<=nT])
+ d.nodes<- append(d.nodes, desc[desc>nT])
+ 
+ if (node<=nT)	d.tips<- node
+ else{
+ while(!all(desc<=nT))  # true if some desc are nodes not tips
+  {
+  desc<- ee[ee[,1] %in% desc,2]
+  #print(desc)
+  d.tips<- append(d.tips, desc[desc<=nT])
+  d.nodes<- append(d.nodes, desc[desc>nT])  	
+  }
+ }
+ return(list(tips=d.tips, nodes=d.nodes, node.label=node))
+}
\ No newline at end of file

Added: branches/will/man/node.desc.Rd
===================================================================
--- branches/will/man/node.desc.Rd	                        (rev 0)
+++ branches/will/man/node.desc.Rd	2009-11-20 05:28:30 UTC (rev 208)
@@ -0,0 +1,30 @@
+\name{node.desc}
+\Rdversion{1.1}
+\alias{node.desc}
+\title{
+Descendants of a particular node
+}
+\description{
+Finds the descendants from a particular node
+}
+\usage{
+node.desc(tr, node)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+  \item{tr}{
+an object of class phylo
+}
+  \item{node}{
+node number
+}
+}
+
+
+\note{
+utility function.  modified from node.sons from  Walton Green, Gene Hunt, Scott Wing 
+This function could easily be hidden for simplicity's sake.
+
+}
+
+



More information about the Picante-commits mailing list