[Phylobase-commits] r134 - in pkg: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 2 23:35:14 CET 2008


Author: skembel
Date: 2008-03-02 23:35:14 +0100 (Sun, 02 Mar 2008)
New Revision: 134

Modified:
   pkg/R/phylo4.R
   pkg/TODO
Log:
Minimal check for consistency when assigning tip labels with labels(foo)<-bar

Modified: pkg/R/phylo4.R
===================================================================
--- pkg/R/phylo4.R	2008-03-02 22:15:38 UTC (rev 133)
+++ pkg/R/phylo4.R	2008-03-02 22:35:14 UTC (rev 134)
@@ -157,7 +157,6 @@
 setMethod("labels","phylo4", function(object,...) {
     object at tip.label
 })
-
 setMethod("labels","phylo4", function(object,which=c("tip","node","allnode"),...) {
     which <- match.arg(which)
     switch(which,tip=object at tip.label,node=object at node.label,
@@ -168,8 +167,9 @@
            function(object,...,value) {
                standardGeneric("labels<-")
            })
-
 setMethod("labels<-","phylo4", function(object,...,value) {
+    if (length(value) != length(object at tip.label))
+        stop("Number of tip labels does not match number of tips.")
     object at tip.label <- value
     object
 })

Modified: pkg/TODO
===================================================================
--- pkg/TODO	2008-03-02 22:15:38 UTC (rev 133)
+++ pkg/TODO	2008-03-02 22:35:14 UTC (rev 134)
@@ -16,7 +16,6 @@
 ## Data classes
 ### Tree model:
 * assigning edge and node labels -- is there/should there be an option to turn this off?  assign empty ("") labels? how about assigning the node number if there are no user-supplied labels?(mb)
-* basic checks when assigning labels (do number of labels and number of nodes/tips match?)
 * should default node labels start at N(nTips+1), to match internal node numbers?
 * should coercing phylo4d to phylo4 give a warning message about losing data?   Should phylo4d to phylo4?  Yes(mb)
 * order: All phylo4 edge matrices are internally stored as "cladewise"/Newick traversal order.  Extend edges accessor method with optional argument that allows edges to be extracted in a different order (possibly with an attribute as in ape); need to steal 'reorder' from ape, extend for phylo4d keeping track of traits also see ape::ladderize



More information about the Phylobase-commits mailing list