[Phylobase-commits] r138 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 6 03:57:22 CET 2008


Author: bbolker
Date: 2008-03-06 03:57:22 +0100 (Thu, 06 Mar 2008)
New Revision: 138

Modified:
   pkg/R/subset.R
   pkg/R/treewalk.R
   pkg/man/multiPhylo-class.Rd
   pkg/man/treewalk.Rd
Log:
  oops, fixing problems




Modified: pkg/R/subset.R
===================================================================
--- pkg/R/subset.R	2008-03-06 02:49:54 UTC (rev 137)
+++ pkg/R/subset.R	2008-03-06 02:57:22 UTC (rev 138)
@@ -23,12 +23,12 @@
               }
               
               if (!is.null(node.subtree)) {
-                  return(prune(x,x at tip.label[!(x at tip.label %in% allDescend(x,node.subtree))]))
+                  return(prune(x,x at tip.label[!(x at tip.label %in% names(descendants(x,node.subtree)))]))
               }
               
               if (!is.null(mrca)) {
                   mnode <- MRCA(x,mrca)
-                  return(prune(x,x at tip.label[!(x at tip.label %in% allDescend(x,mnode))]))
+                  return(prune(x,x at tip.label[!(x at tip.label %in% names(descendants(x,mnode)))]))
               }
               arglist <- list(...)
               if (length(arglist)>0) {

Modified: pkg/R/treewalk.R
===================================================================
--- pkg/R/treewalk.R	2008-03-06 02:49:54 UTC (rev 137)
+++ pkg/R/treewalk.R	2008-03-06 02:57:22 UTC (rev 138)
@@ -7,35 +7,35 @@
 ## x = n-nTips(phy)
 ## so:     n = x+nTips(phy)
 
-getnodes <- function(phy,x) {
-    if (is.numeric(x) && all(floor(x)==x)) {
-        x <- as.integer(x)
+getnodes <- function(phy,node) {
+    if (is.numeric(node) && all(floor(node)==node)) {
+        node <- as.integer(node)
     }
-    if (is.character(x)) {
+    if (is.character(node)) {
         ## old getNodeByLabel()
         nt <- nTips(phy)
-        tipmatch <- match(x,labels(phy,"all"))
+        tipmatch <- match(node,labels(phy,"all"))
         vals <- ifelse(!is.na(tipmatch),
                        tipmatch,
                        if (!hasNodeLabels(phy)) { NA } else {
-                           nt+match(x,NodeLabels(phy))
+                           nt+match(node,NodeLabels(phy))
                        })
-        names(vals) <- x
+        names(vals) <- node
         return(vals)
-    } else if (is.integer(x)) {
+    } else if (is.integer(node)) {
         ## old getLabelByNode
         nt <- nTips(phy)
-        vals <- ifelse(x<=nt,  ## tips
-                       labels(phy,"all")[x], 
-                       ifelse(x<=nt+nNodes(phy),
+        vals <- ifelse(node<=nt,  ## tips
+                       labels(phy,"all")[node], 
+                       ifelse(node<=nt+nNodes(phy),
                               if (!hasNodeLabels(phy)) { NA }
                               else {
-                                  NodeLabels(phy)[pmax(0,x-nt)]
+                                  NodeLabels(phy)[pmax(0,node-nt)]
                               },NA))
         ## pmax above to avoid error from negative indices
-        names(x) <- vals
-        return(x)
-    } else stop("x must be integer or character")
+        names(node) <- vals
+        return(node)
+    } else stop("node must be integer or character")
 }
 
 

Modified: pkg/man/multiPhylo-class.Rd
===================================================================
--- pkg/man/multiPhylo-class.Rd	2008-03-06 02:49:54 UTC (rev 137)
+++ pkg/man/multiPhylo-class.Rd	2008-03-06 02:57:22 UTC (rev 138)
@@ -3,6 +3,7 @@
 \alias{multiPhylo-class}
 \alias{multiPhylo4-class}
 \alias{multiPhylo4d-class}
+\alias{tbind}
 \title{multiPhylo4 and extended classes}
 \description{Classes for lists of phylogenetic trees
 (FIXME: passes check but very incomplete)}

Modified: pkg/man/treewalk.Rd
===================================================================
--- pkg/man/treewalk.Rd	2008-03-06 02:49:54 UTC (rev 137)
+++ pkg/man/treewalk.Rd	2008-03-06 02:57:22 UTC (rev 138)
@@ -4,15 +4,14 @@
 \alias{descendants}
 \alias{ancestors}
 \alias{MRCA}
-\alias{getNodeByLabel}
-\alias{getLabelByNode}
+\alias{getnodes}
 \title{tree traversal and utility functions}
 \description{
   Functions for describing relationships among
   phylogenetic nodes
 }
 \usage{
-getNodeByLabel(phy,lab)
+getnodes(phy,node)
 parent(phy, node)
 children(phy, node)
 descendants(phy, node, which=c("tips","all"))
@@ -23,7 +22,6 @@
   \item{phy}{a \code{phylo4} object (or one inheriting from
     \code{phylo4}, e.g. a \code{phylo4d} object)
   }
-  \item{lab}{a character label}
   \item{node}{a node number (or name)}
   \item{which}{whether to return all descendant nodes, or just tips
     (which="all" is not yet implemented)}



More information about the Phylobase-commits mailing list