[Phylobase-commits] r395 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 22 05:34:45 CET 2008


Author: pdc
Date: 2008-12-22 05:34:45 +0100 (Mon, 22 Dec 2008)
New Revision: 395

Modified:
   pkg/R/checkdata.R
Log:
Fix for when the root edge length is not set

Modified: pkg/R/checkdata.R
===================================================================
--- pkg/R/checkdata.R	2008-12-22 04:33:50 UTC (rev 394)
+++ pkg/R/checkdata.R	2008-12-22 04:34:45 UTC (rev 395)
@@ -8,9 +8,15 @@
     ## FIXME: check for cyclicity?
     nedges <- nrow(object at edge)
     if (hasEdgeLength(object)) {
+        print(object at edge.length)
       if (length(object at edge.length) != nedges)
         return("edge lengths do not match number of edges")
-      if (any(object at edge.length<0))
+      ## presumably we shouldn't allow NAs mixed 
+      ## with numeric branch lengths except at the root
+      if (sum(is.na(object at edge.length)) > 1)
+        return("NAs in edge lenghts")
+      ## Strip root edge branch lenght (if set to NA)
+      if (any(object at edge.length[!is.na(object at edge.length)] < 0))
         return("edge lengths must be non-negative")
     }
     ## if (length(object at tip.label)+object at Nnode-1 != N) # does not work with multifurcations



More information about the Phylobase-commits mailing list