[Adephylo-commits] r11 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 20 19:55:44 CET 2008


Author: jombart
Date: 2008-11-20 19:55:44 +0100 (Thu, 20 Nov 2008)
New Revision: 11

Added:
   pkg/man/listTips.Rd
Modified:
   pkg/R/partition.R
Log:
Added listTips doc.


Modified: pkg/R/partition.R
===================================================================
--- pkg/R/partition.R	2008-11-20 18:39:10 UTC (rev 10)
+++ pkg/R/partition.R	2008-11-20 18:55:44 UTC (rev 11)
@@ -20,7 +20,9 @@
     if (is.character(checkval <- check_phylo4(x))) stop(checkval)
 
     ## computations
-    res <- lapply(1:nNodes(x), function(i) descendants(x, i))
+    nodIdx <- nTips(x)+1
+    nodIdx <- nodIdx:(nodIdx+nNodes(x)-1)
+    res <- lapply(nodIdx, function(i) descendants(x, i))
 
     if(hasNodeLabels(x)) {names(res) <- nodeLabels(x)}
 

Added: pkg/man/listTips.Rd
===================================================================
--- pkg/man/listTips.Rd	                        (rev 0)
+++ pkg/man/listTips.Rd	2008-11-20 18:55:44 UTC (rev 11)
@@ -0,0 +1,33 @@
+\name{listTips}
+\alias{listTips}
+\title{List tips descendings from all nodes of a tree}
+\description{
+  The function \code{listTips} lists the tips descending from each node
+  of a tree. The tree can be of class \code{\link[pkg:ape]{phylo}},
+  \linkS4class{phylo4} or \linkS4class{phylo4d}.
+}
+\usage{
+listTips(x)
+}
+\arguments{
+  \item{x}{A tree of  class \code{\link[pkg:ape]{phylo}},
+    \linkS4class{phylo4} or \linkS4class{phylo4d}.}
+}
+\value{
+  A list whose components are vectors of named tips for a given node.
+}
+\author{ Thibaut Jombart \email{jombart at biomserv.univ-lyon1.fr} }
+\seealso{\code{\link{treePart}} which lists the direct descendants for
+  each node. \cr
+  
+  \code{\link{treePart}} which defines partitions of tips
+  according to the tree topology.}
+\examples{
+if(require(ape) & require(phylobase)){
+## make a tree
+x <- as(rtree(20),"phylo4")
+plot(x,show.node=TRUE)
+listTips(x)
+}
+}
+\keyword{manip}



More information about the Adephylo-commits mailing list