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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Dec 19 21:04:32 CET 2008


Author: bbolker
Date: 2008-12-19 21:04:31 +0100 (Fri, 19 Dec 2008)
New Revision: 336

Modified:
   pkg/R/methods-phylo4.R
   pkg/R/phylo4.R
   pkg/man/treewalk.Rd
Log:
 changed nodeNumbers to nodeId, extended



Modified: pkg/R/methods-phylo4.R
===================================================================
--- pkg/R/methods-phylo4.R	2008-12-19 19:58:11 UTC (rev 335)
+++ pkg/R/methods-phylo4.R	2008-12-19 20:04:31 UTC (rev 336)
@@ -124,8 +124,12 @@
     x at node.label
 })
 
-setMethod("nodeNumbers", "phylo4", function(x) {
-    c(nTips(x)+1,x at edge[x at edge[,2]>nTips(x),2])
+setMethod("nodeId", "phylo4", function(x,which=c("internal","tip","all")) {
+  which <- match.arg(which)
+  switch(which,
+         internal=x at edge[x at edge[,2]>nTips(x),2],
+         tip = x at edge[x at edge[,2]<=nTips(x),2],
+         all = x at edge[x at edge[,2]])
 })
 
 setReplaceMethod("nodeLabels", "phylo4",

Modified: pkg/R/phylo4.R
===================================================================
--- pkg/R/phylo4.R	2008-12-19 19:58:11 UTC (rev 335)
+++ pkg/R/phylo4.R	2008-12-19 20:04:31 UTC (rev 336)
@@ -65,8 +65,8 @@
                standardGeneric("nodeLabels<-")
            })
 
-setGeneric("nodeNumbers", function(x) {
-    standardGeneric("nodeNumbers")
+setGeneric("nodeId", function(x,which) {
+    standardGeneric("nodeId")
 })
 
 setGeneric("edgeLabels", function(x) {

Modified: pkg/man/treewalk.Rd
===================================================================
--- pkg/man/treewalk.Rd	2008-12-19 19:58:11 UTC (rev 335)
+++ pkg/man/treewalk.Rd	2008-12-19 20:04:31 UTC (rev 336)
@@ -10,6 +10,8 @@
 \alias{shortestPath}
 \alias{sumEdgeLength}
 \alias{sumEdgeLength,phylo4-method}
+\alias{nodeId}
+\alias{nodeId,phylo4-method}
 \title{tree traversal and utility functions}
 \description{
   Functions for describing relationships among



More information about the Phylobase-commits mailing list