[Phylobase-commits] r390 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Dec 22 03:30:59 CET 2008
Author: bbolker
Date: 2008-12-22 03:30:59 +0100 (Mon, 22 Dec 2008)
New Revision: 390
Modified:
pkg/R/checkdata.R
Log:
test for negative edge lengths
Modified: pkg/R/checkdata.R
===================================================================
--- pkg/R/checkdata.R 2008-12-21 23:47:12 UTC (rev 389)
+++ pkg/R/checkdata.R 2008-12-22 02:30:59 UTC (rev 390)
@@ -7,8 +7,12 @@
check_tree <- function(object,warn="retic",err=NULL) {
## FIXME: check for cyclicity?
nedges <- nrow(object at edge)
- if (hasEdgeLength(object) && length(object at edge.length) != nedges)
- return("edge lengths do not match number of edges")
+ if (hasEdgeLength(object)) {
+ if (length(object at edge.length) != nedges)
+ return("edge lengths do not match number of edges")
+ if (any(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
## return("number of tip labels not consistent with number of edges and nodes")
## check: tip numbers = (m+1):(m+n)
More information about the Phylobase-commits
mailing list